Skip to content
This repository has been archived by the owner on Oct 20, 2021. It is now read-only.

Latest commit

 

History

History
23 lines (18 loc) · 649 Bytes

key.md

File metadata and controls

23 lines (18 loc) · 649 Bytes

Key

Validates an array key.

Valid values:

validator.key(0).validate(['foo']);
validator.key('foo').validate({foo: 'bar'});
validator.key('foo').validate(new Map<string, string>([['foo', 'bar']]));
validator.key('foo', validator.stringType()).validate(new Map<string, string>([['foo', 'bar']]));
validator.key(null, undefined, false).validate('foo');

Invalid values:

validator.key('foo').validate(new Set('foo'));
validator.key('foo').validate({bar: 'foo'});
validator.key('foo').validate([]);
validator.key('foo', validator.intType()).validate(new Map<string, string>([['foo', 'bar']]));
validator.key(null).validate([]);