Skip to content

email验证是不是存在BUG #66

Open

Description

@matrixpool

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: 'xx@163.com'
};

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' ]
另外,什么时候能够支持手机号码验证?

Activity

  1. matrixpool commented on Jun 6, 2019

    @matrixpool
    Author

    怎么没人出来回答?

  2. matrixpool commented on Jun 6, 2019

    @matrixpool
    Author
  3. llh1187 commented on Mar 1, 2020

    @llh1187

    Parameter.EMAIL_RE

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

  4. llh1187 commented on Mar 1, 2020

    @llh1187
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions