5454 } ;
5555 }
5656 } ) ;
57- </ script > </ nav > </ div > < div class ="container mainContainer "> < div class ="wrapper "> < div class ="post "> < header class ="postHeader "> < a class ="edit-page-link button " href ="https://github.com/express-validator/express-validator/edit/master/docs/api-check.md " target ="_blank " rel ="noreferrer noopener "> Edit</ a > < h1 class ="postHeaderTitle "> check API</ h1 > </ header > < article > < div > < span > < p > These methods are all available via < code > require('express-validator/check')</ code > .</ p >
58- < h2 > < a class ="anchor " aria-hidden ="true " id ="check-field- message "> </ a > < a href ="#check-field -message " aria-hidden ="true " class ="hash-link "> < svg class ="hash-link-icon " aria-hidden ="true " height ="16 " version ="1.1 " viewBox ="0 0 16 16 " width ="16 "> < path fill-rule ="evenodd " d ="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z "> </ path > </ svg > </ a > < code > check([field, message])</ code > </ h2 >
57+ </ script > </ nav > </ div > < div class ="container mainContainer docsContainer "> < div class ="wrapper "> < div class ="post "> < header class ="postHeader "> < a class ="edit-page-link button " href ="https://github.com/express-validator/express-validator/edit/master/docs/api-check.md " target ="_blank " rel ="noreferrer noopener "> Edit</ a > < h1 id =" __docusaurus " class ="postHeaderTitle "> check API</ h1 > </ header > < article > < div > < span > < p > These methods are all available via < code > require('express-validator/check')</ code > .</ p >
58+ < h2 > < a class ="anchor " aria-hidden ="true " id ="checkfield- message "> </ a > < a href ="#checkfield -message " aria-hidden ="true " class ="hash-link "> < svg class ="hash-link-icon " aria-hidden ="true " height ="16 " version ="1.1 " viewBox ="0 0 16 16 " width ="16 "> < path fill-rule ="evenodd " d ="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z "> </ path > </ svg > </ a > < code > check([field, message])</ code > </ h2 >
5959< ul >
6060< li > < code > field</ code > < em > (optional)</ em > : a string or an array of strings of field names to validate against.</ li >
6161< li > < code > message</ code > < em > (optional)</ em > : an error message to use when failed validators don't specify a message. Defaults to < code > Invalid value</ code > ; see also < a href ="/docs/5.2.0/custom-error-messages.html#dynamic-messages "> Dynamic Messages</ a > .</ li >
@@ -76,15 +76,15 @@ <h2><a class="anchor" aria-hidden="true" id="check-field-message"></a><a href="#
7676This is only useful for < code > req.body</ code > , though; see < a href ="/docs/5.2.0/whole-body-validation.html "> Whole Body Validation</ a > for examples.</ p >
7777< p > The validators will always be executed serially for the same field.< br >
7878This means that if the chain targets more than one field, those will run in parallel, but each of their validators are serial.</ p >
79- < h2 > < a class ="anchor " aria-hidden ="true " id ="body-fields- message "> </ a > < a href ="#body-fields -message " aria-hidden ="true " class ="hash-link "> < svg class ="hash-link-icon " aria-hidden ="true " height ="16 " version ="1.1 " viewBox ="0 0 16 16 " width ="16 "> < path fill-rule ="evenodd " d ="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z "> </ path > </ svg > </ a > < code > body([fields, message])</ code > </ h2 >
79+ < h2 > < a class ="anchor " aria-hidden ="true " id ="bodyfields- message "> </ a > < a href ="#bodyfields -message " aria-hidden ="true " class ="hash-link "> < svg class ="hash-link-icon " aria-hidden ="true " height ="16 " version ="1.1 " viewBox ="0 0 16 16 " width ="16 "> < path fill-rule ="evenodd " d ="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z "> </ path > </ svg > </ a > < code > body([fields, message])</ code > </ h2 >
8080< p > Same as < code > check([fields, message])</ code > , but only checking < code > req.body</ code > .</ p >
81- < h2 > < a class ="anchor " aria-hidden ="true " id ="cookie-fields- message "> </ a > < a href ="#cookie-fields -message " aria-hidden ="true " class ="hash-link "> < svg class ="hash-link-icon " aria-hidden ="true " height ="16 " version ="1.1 " viewBox ="0 0 16 16 " width ="16 "> < path fill-rule ="evenodd " d ="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z "> </ path > </ svg > </ a > < code > cookie([fields, message])</ code > </ h2 >
81+ < h2 > < a class ="anchor " aria-hidden ="true " id ="cookiefields- message "> </ a > < a href ="#cookiefields -message " aria-hidden ="true " class ="hash-link "> < svg class ="hash-link-icon " aria-hidden ="true " height ="16 " version ="1.1 " viewBox ="0 0 16 16 " width ="16 "> < path fill-rule ="evenodd " d ="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z "> </ path > </ svg > </ a > < code > cookie([fields, message])</ code > </ h2 >
8282< p > Same as < code > check([fields, message])</ code > , but only checking < code > req.cookies</ code > .</ p >
83- < h2 > < a class ="anchor " aria-hidden ="true " id ="header-fields- message "> </ a > < a href ="#header-fields -message " aria-hidden ="true " class ="hash-link "> < svg class ="hash-link-icon " aria-hidden ="true " height ="16 " version ="1.1 " viewBox ="0 0 16 16 " width ="16 "> < path fill-rule ="evenodd " d ="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z "> </ path > </ svg > </ a > < code > header([fields, message])</ code > </ h2 >
83+ < h2 > < a class ="anchor " aria-hidden ="true " id ="headerfields- message "> </ a > < a href ="#headerfields -message " aria-hidden ="true " class ="hash-link "> < svg class ="hash-link-icon " aria-hidden ="true " height ="16 " version ="1.1 " viewBox ="0 0 16 16 " width ="16 "> < path fill-rule ="evenodd " d ="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z "> </ path > </ svg > </ a > < code > header([fields, message])</ code > </ h2 >
8484< p > Same as < code > check([fields, message])</ code > , but only checking < code > req.headers</ code > .</ p >
85- < h2 > < a class ="anchor " aria-hidden ="true " id ="param-fields- message "> </ a > < a href ="#param-fields -message " aria-hidden ="true " class ="hash-link "> < svg class ="hash-link-icon " aria-hidden ="true " height ="16 " version ="1.1 " viewBox ="0 0 16 16 " width ="16 "> < path fill-rule ="evenodd " d ="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z "> </ path > </ svg > </ a > < code > param([fields, message])</ code > </ h2 >
85+ < h2 > < a class ="anchor " aria-hidden ="true " id ="paramfields- message "> </ a > < a href ="#paramfields -message " aria-hidden ="true " class ="hash-link "> < svg class ="hash-link-icon " aria-hidden ="true " height ="16 " version ="1.1 " viewBox ="0 0 16 16 " width ="16 "> < path fill-rule ="evenodd " d ="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z "> </ path > </ svg > </ a > < code > param([fields, message])</ code > </ h2 >
8686< p > Same as < code > check([fields, message])</ code > , but only checking < code > req.params</ code > .</ p >
87- < h2 > < a class ="anchor " aria-hidden ="true " id ="query-fields- message "> </ a > < a href ="#query-fields -message " aria-hidden ="true " class ="hash-link "> < svg class ="hash-link-icon " aria-hidden ="true " height ="16 " version ="1.1 " viewBox ="0 0 16 16 " width ="16 "> < path fill-rule ="evenodd " d ="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z "> </ path > </ svg > </ a > < code > query([fields, message])</ code > </ h2 >
87+ < h2 > < a class ="anchor " aria-hidden ="true " id ="queryfields- message "> </ a > < a href ="#queryfields -message " aria-hidden ="true " class ="hash-link "> < svg class ="hash-link-icon " aria-hidden ="true " height ="16 " version ="1.1 " viewBox ="0 0 16 16 " width ="16 "> < path fill-rule ="evenodd " d ="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z "> </ path > </ svg > </ a > < code > query([fields, message])</ code > </ h2 >
8888< p > Same as < code > check([fields, message])</ code > , but only checking < code > req.query</ code > .</ p >
8989< h2 > < a class ="anchor " aria-hidden ="true " id ="checkschemaschema "> </ a > < a href ="#checkschemaschema " aria-hidden ="true " class ="hash-link "> < svg class ="hash-link-icon " aria-hidden ="true " height ="16 " version ="1.1 " viewBox ="0 0 16 16 " width ="16 "> < path fill-rule ="evenodd " d ="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z "> </ path > </ svg > </ a > < code > checkSchema(schema)</ code > </ h2 >
9090< ul >
@@ -161,4 +161,4 @@ <h2><a class="anchor" aria-hidden="true" id="buildcheckfunctionlocations"></a><a
161161 checkBodyAndQuery(< span class ="hljs-string "> 'id'</ span > ).isUUID()
162162], productUpdateHandler)
163163</ code > </ pre >
164- </ span > </ div > </ article > </ div > < div class ="docs-prevnext "> < a class ="docs-prev button " href ="/docs/5.2.0/whole-body-validation.html "> < span class ="arrow-prev "> ← </ span > < span > Whole Body Validation</ span > </ a > < a class ="docs-next button " href ="/docs/5.2.0/filter-api.html "> < span > Sanitization middlewares</ span > < span class ="arrow-next "> →</ span > </ a > </ div > </ div > </ div > < nav class ="onPageNav "> < ul class ="toc-headings "> < li > < a href ="#check-field-message "> < code > check([field, message])</ code > </ a > </ li > < li > < a href ="#body-fields-message "> < code > body([fields, message])</ code > </ a > </ li > < li > < a href ="#cookie-fields-message "> < code > cookie([fields, message])</ code > </ a > </ li > < li > < a href ="#header-fields-message "> < code > header([fields, message])</ code > </ a > </ li > < li > < a href ="#param-fields-message "> < code > param([fields, message])</ code > </ a > </ li > < li > < a href ="#query-fields-message "> < code > query([fields, message])</ code > </ a > </ li > < li > < a href ="#checkschemaschema "> < code > checkSchema(schema)</ code > </ a > </ li > < li > < a href ="#oneofvalidationchains-message "> < code > oneOf(validationChains[, message])</ code > </ a > </ li > < li > < a href ="#validationresultreq "> < code > validationResult(req)</ code > </ a > </ li > < li > < a href ="#buildcheckfunctionlocations "> < code > buildCheckFunction(locations)</ code > </ a > </ li > </ ul > </ nav > </ div > < footer class ="nav-footer " id ="footer "> < section class ="sitemap "> < a href ="/ " class ="nav-home "> < img src ="/img/logo.svg " alt ="express-validator " width ="66 " height ="58 "/> </ a > < div > < h5 > Docs</ h5 > < a href ="/docs/index.html "> Getting Started</ a > < a href ="/docs/check-api.html "> API Reference</ a > </ div > < div > < h5 > Community</ h5 > < a href ="http://stackoverflow.com/questions/tagged/express-validator " target ="_blank " rel ="noreferrer noopener "> Stack Overflow</ a > </ div > < div > < h5 > More</ h5 > < a href ="https://github.com/express-validator/express-validator "> GitHub</ a > < a class ="github-button " href ="https://github.com/express-validator/express-validator " data-icon ="octicon-star " data-count-href ="/express-validator/express-validator/stargazers " data-show-count ="true " data-count-aria-label ="# stargazers on GitHub " aria-label ="Star this project on GitHub "> Star</ a > </ div > </ section > < section class ="copyright "> Copyright © 2019 express-validator</ section > </ footer > </ div > </ body > </ html >
164+ </ span > </ div > </ article > </ div > < div class ="docs-prevnext "> < a class ="docs-prev button " href ="/docs/5.2.0/whole-body-validation.html "> < span class ="arrow-prev "> ← </ span > < span > Whole Body Validation</ span > </ a > < a class ="docs-next button " href ="/docs/5.2.0/filter-api.html "> < span > Sanitization middlewares</ span > < span class ="arrow-next "> →</ span > </ a > </ div > </ div > </ div > < nav class ="onPageNav "> < ul class ="toc-headings "> < li > < a href ="#checkfield-message "> < code > check([field, message])</ code > </ a > </ li > < li > < a href ="#bodyfields-message "> < code > body([fields, message])</ code > </ a > </ li > < li > < a href ="#cookiefields-message "> < code > cookie([fields, message])</ code > </ a > </ li > < li > < a href ="#headerfields-message "> < code > header([fields, message])</ code > </ a > </ li > < li > < a href ="#paramfields-message "> < code > param([fields, message])</ code > </ a > </ li > < li > < a href ="#queryfields-message "> < code > query([fields, message])</ code > </ a > </ li > < li > < a href ="#checkschemaschema "> < code > checkSchema(schema)</ code > </ a > </ li > < li > < a href ="#oneofvalidationchains-message "> < code > oneOf(validationChains[, message])</ code > </ a > </ li > < li > < a href ="#validationresultreq "> < code > validationResult(req)</ code > </ a > </ li > < li > < a href ="#buildcheckfunctionlocations "> < code > buildCheckFunction(locations)</ code > </ a > </ li > </ ul > </ nav > </ div > < footer class ="nav-footer " id ="footer "> < section class ="sitemap "> < a href ="/ " class ="nav-home "> < img src ="/img/logo.svg " alt ="express-validator " width ="66 " height ="58 "/> </ a > < div > < h5 > Docs</ h5 > < a href ="/docs/index.html "> Getting Started</ a > < a href ="/docs/check-api.html "> API Reference</ a > </ div > < div > < h5 > Community</ h5 > < a href ="http://stackoverflow.com/questions/tagged/express-validator " target ="_blank " rel ="noreferrer noopener "> Stack Overflow</ a > </ div > < div > < h5 > More</ h5 > < a href ="https://github.com/express-validator/express-validator "> GitHub</ a > < a class ="github-button " href ="https://github.com/express-validator/express-validator " data-icon ="octicon-star " data-count-href ="/express-validator/express-validator/stargazers " data-show-count ="true " data-count-aria-label ="# stargazers on GitHub " aria-label ="Star this project on GitHub "> Star</ a > </ div > </ section > < section class ="copyright "> Copyright © 2020 express-validator</ section > </ footer > </ div > </ body > </ html >
0 commit comments