1 | "use strict";
|
2 |
|
3 | var _interopRequireDefault = require("@babel/runtime/helpers/builtin/interopRequireDefault");
|
4 |
|
5 | exports.__esModule = true;
|
6 | exports.default = void 0;
|
7 |
|
8 | var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/builtin/objectWithoutPropertiesLoose"));
|
9 |
|
10 | var _isSchema = _interopRequireDefault(require("./util/isSchema"));
|
11 |
|
12 | var Lazy =
|
13 |
|
14 | function () {
|
15 | function Lazy(mapFn) {
|
16 | this._resolve = function () {
|
17 | var schema = mapFn.apply(void 0, arguments);
|
18 | if (!(0, _isSchema.default)(schema)) throw new TypeError('lazy() functions must return a valid schema');
|
19 | return schema;
|
20 | };
|
21 | }
|
22 |
|
23 | var _proto = Lazy.prototype;
|
24 |
|
25 | _proto.resolve = function resolve(_ref) {
|
26 | var value = _ref.value,
|
27 | rest = (0, _objectWithoutPropertiesLoose2.default)(_ref, ["value"]);
|
28 | return this._resolve(value, rest);
|
29 | };
|
30 |
|
31 | _proto.cast = function cast(value, options) {
|
32 | return this._resolve(value, options).cast(value, options);
|
33 | };
|
34 |
|
35 | _proto.validate = function validate(value, options) {
|
36 | return this._resolve(value, options).validate(value, options);
|
37 | };
|
38 |
|
39 | return Lazy;
|
40 | }();
|
41 |
|
42 | Lazy.prototype.__isYupSchema__ = true;
|
43 | var _default = Lazy;
|
44 | exports.default = _default;
|
45 | module.exports = exports["default"]; |
\ | No newline at end of file |