Array Validator

API ReferenceSchemaArray Validator

Determines whether the tested value is an array.

var schema = new Schema({
  friends: {
    array: true
  }
});

console.log(utils.catchError(schema.validate, schema, [{friends: {}}])+'');
// "SchemaError: friends must be an array"

console.log(schema.validate({friends: []}));
// true

Source

results matching ""

    No results matching ""