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

Latest commit

 

History

History
17 lines (12 loc) · 361 Bytes

optional.md

File metadata and controls

17 lines (12 loc) · 361 Bytes

Optional

Validates if the given input is optional or not.

Valid values:

validator.optional(validator.AlwaysInvalid()).validate(null);
validator.optional(validator.AlwaysInvalid()).validate('');
validator.optional(validator.AlwaysValid()).validate('foo');

Invalid values:

validator.optional(validator.AlwaysInvalid()).validate('foo');