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

Latest commit

 

History

History
19 lines (14 loc) · 531 Bytes

callback.md

File metadata and controls

19 lines (14 loc) · 531 Bytes

Callback

This is a wildcard validator, it uses a function name, method or closure to validate something.

Valid values:

validator.callback((): boolean => true).validate(null);
validator.callback((input: any): boolean => input === 'foo').validate('foo');
validator.callback('Array.isArray').validate([]);

Invalid values:

validator.callback((): boolean => false).validate(null);
validator.callback((input: any): boolean => input === 'foo').validate('bar');
validator.callback('Array.isArray').validate({});