1 | import mixed from './mixed';
|
2 | import bool from './boolean';
|
3 | import string from './string';
|
4 | import number from './number';
|
5 | import date from './date';
|
6 | import object from './object';
|
7 | import array from './array';
|
8 | import Ref from './Reference';
|
9 | import Lazy from './Lazy';
|
10 | import ValidationError from './ValidationError';
|
11 | import reach from './util/reach';
|
12 | import isSchema from './util/isSchema';
|
13 | import setLocale from './setLocale';
|
14 | var boolean = bool;
|
15 |
|
16 | var ref = function ref(key, options) {
|
17 | return new Ref(key, options);
|
18 | };
|
19 |
|
20 | var lazy = function lazy(fn) {
|
21 | return new Lazy(fn);
|
22 | };
|
23 |
|
24 | function addMethod(schemaType, name, fn) {
|
25 | if (!schemaType || !isSchema(schemaType.prototype)) throw new TypeError('You must provide a yup schema constructor function');
|
26 | if (typeof name !== 'string') throw new TypeError('A Method name must be provided');
|
27 | if (typeof fn !== 'function') throw new TypeError('Method function must be provided');
|
28 | schemaType.prototype[name] = fn;
|
29 | }
|
30 |
|
31 | export { mixed, string, number, bool, boolean, date, object, array, ref, lazy, reach, isSchema, addMethod, setLocale, ValidationError }; |
\ | No newline at end of file |