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

Exception while using any for isMobilePhone validation #697

Closed
AnkurThakur opened this issue Aug 21, 2017 · 1 comment
Closed

Exception while using any for isMobilePhone validation #697

AnkurThakur opened this issue Aug 21, 2017 · 1 comment

Comments

@AnkurThakur
Copy link

Hi,

When I'm trying to use any(#663) in the isMobilePhone validation, it throws me a TypeError. Please see the example below:

var validator = require('validator'); console.log("Mobile Valid", validator.isMobilePhone("+16173324656", "any"));
It throws a TypeError:

D:\Exsete\Projects\NodeJS\validator\node_modules\validator\lib\isMobilePhone.js:75
    return !!Object.values(phones).find(function (phone) {
                    ^
TypeError: Object.values is not a function
    at Object.isMobilePhone (D:\Exsete\Projects\NodeJS\validator\node_modules\validator\lib\isMobilePhone.js:75:21)
    at Object.<anonymous> (D:\Exsete\Projects\NodeJS\validator\index.js:5:39)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.runMain (module.js:604:10)
    at run (bootstrap_node.js:389:7)
    at startup (bootstrap_node.js:149:9)

But, individually when you will try en-US in place of that, it works.

Windows with Node 6.11.0: Doesn't work
Debian 7 Wheezy with Node 8.4.0: Works

So, what I concluded from this answer is that it requires the latest node version. We should mention it somewhere as I got to know about this problem when my code broke in the production environment.

@chriso
Copy link
Collaborator

chriso commented Aug 22, 2017

Dupe: #681

@chriso chriso closed this as completed Aug 22, 2017
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

2 participants