Skip to content

Improve validator for arrays #2

@ghost

Description

If we want to check all array elements, we must iterate it:

var pos = 0;
users.forEach(function(userId) {
    checkval(userId, 'users.' + pos++).numeric().throw();
});

Proposition:

checkval(users, 'users').array().numeric().throw();

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions