Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rule 'digits' allows spaces #322

Open
kculmback opened this issue Mar 12, 2019 · 4 comments
Open

Rule 'digits' allows spaces #322

kculmback opened this issue Mar 12, 2019 · 4 comments
Assignees

Comments

@kculmback
Copy link

Using the rule 'digits:5' as part of validating zip codes. When testing, the rule allows for spaces in the zip code, which it shouldn't. For example 9980 passes validation.

igor875126 added a commit to igor875126/validatorjs that referenced this issue Aug 18, 2020
@mikeerickson mikeerickson self-assigned this Dec 12, 2020
@mikeerickson
Copy link
Owner

Available in current release

@amal-chacko-7
Copy link

amal-chacko-7 commented Feb 28, 2021

@mikeerickson @igor875126 trim() function not defined for integer values.
(node:7608) UnhandledPromiseRejectionWarning: TypeError: val.trim is not a function at Rule.digits [as fn] (F:\Workspace\node-barebone\node_modules\validatorjs\src\rules.js:376:49) at Rule._apply (F:\Workspace\node-barebone\node_modules\validatorjs\src\rules.js:634:15) at Rule.validate (F:\Workspace\node-barebone\node_modules\validatorjs\src\rules.js:616:36) at F:\Workspace\node-barebone\node_modules\validatorjs\src\validator.js:114:14 at Validator.checkAsync (F:\Workspace\node-barebone\node_modules\validatorjs\src\validator.js:137:63) at Validator.passes (F:\Workspace\node-barebone\node_modules\validatorjs\src\validator.js:495:19) at validator (F:\Workspace\node-barebone\lib\validator.js:4:14) at signup (F:\Workspace\node-barebone\validation\customer\customer_auth.js:12:9) at Layer.handle [as handle_request] (F:\Workspace\node-barebone\node_modules\express\lib\router\layer.js:95:5) at next (F:\Workspace\node-barebone\node_modules\express\lib\router\route.js:137:13) (Use node --trace-warnings ...to show where the warning was created) (node:7608) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag--unhandled-rejections=strict(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:7608) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

@markwbrown
Copy link

markwbrown commented Jul 7, 2021

I can confirm the trim() function not defined for integer values @amal-chacko-7 has reported. Looks like this needs more work. @mikeerickson request reopen

@mikeerickson mikeerickson reopened this Jul 7, 2021
@mikeerickson
Copy link
Owner

@markwbrown i have reopened this issue and will look closer into get this resolved internally. We are preparing a new version and will see to it that this issue is resolved according

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants