Skip to content

How to validate fields in array type subfields? #10

@mocheng

Description

@mocheng

For example, there is params defined as below

var params = {
    users: [
         {
              name: 'mike',
              gender: 'M'
         },
         {
              name: 'tom',
              gender: 'M'
         }
    ]
};

Currently, there is no way to validate the first user's name like
validr.validate('users[0].name', 'first user should have name').isLength(1).

How to extend current method to support this?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions