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

email验证是不是存在BUG #66

Open
matrixpool opened this issue Jun 4, 2019 · 4 comments
Open

email验证是不是存在BUG #66

matrixpool opened this issue Jun 4, 2019 · 4 comments

Comments

@matrixpool
Copy link

const Parameter = require('parameter');
var parameter = new Parameter({
translate: function() {

var args = Array.prototype.slice.call(arguments);
console.log(args);

},
validateRoot: true, // restrict the being validate value must be a object
});
var data = {
name: 'yong',
age: 12,
gender: 'male',
email: '[email protected]'
};

var rule = {
name: 'string',
age: {type:'int', max: 150, min: 0},
gender: ['male', 'female', 'unknown'],
email: {type:'email', format: Parameter.EMAIL_RE}
};

var errors = parameter.validate(rule, data);
if(errors)
console.log(errors);
email正确的情况下,为什么translate函数中还要打印出[ 'should be an email' ]
另外,什么时候能够支持手机号码验证?

@matrixpool
Copy link
Author

怎么没人出来回答?

@matrixpool
Copy link
Author

@fengmk2

@llh1187
Copy link

llh1187 commented Mar 1, 2020

Parameter.EMAIL_RE

现在看npm官网上的用法,是
this.createRule = {
mailAddress: { type: 'email'},
}
应该就行了。

@llh1187
Copy link

llh1187 commented Mar 1, 2020

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