vest 4.2.1-dev-ee64be → 4.2.3-dev-87ebfa
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/classnames.development.js +21 -8
- package/dist/cjs/classnames.production.js +1 -1
- package/dist/cjs/enforce/compose.development.js +27 -59
- package/dist/cjs/enforce/compose.production.js +1 -1
- package/dist/cjs/promisify.development.js +21 -8
- package/dist/cjs/promisify.production.js +1 -1
- package/dist/cjs/vest.development.js +322 -313
- package/dist/cjs/vest.production.js +1 -1
- package/dist/es/classnames.development.js +21 -8
- package/dist/es/classnames.production.js +1 -1
- package/dist/es/enforce/compose.development.js +27 -59
- package/dist/es/enforce/compose.production.js +1 -1
- package/dist/es/promisify.development.js +21 -8
- package/dist/es/promisify.production.js +1 -1
- package/dist/es/vest.development.js +322 -313
- package/dist/es/vest.production.js +1 -1
- package/dist/umd/classnames.development.js +21 -8
- package/dist/umd/classnames.production.js +1 -1
- package/dist/umd/enforce/compose.development.js +73 -83
- package/dist/umd/enforce/compose.production.js +1 -1
- package/dist/umd/enforce/compounds.development.js +18 -20
- package/dist/umd/enforce/compounds.production.js +1 -1
- package/dist/umd/enforce/schema.development.js +18 -20
- package/dist/umd/enforce/schema.production.js +1 -1
- package/dist/umd/promisify.development.js +21 -8
- package/dist/umd/promisify.production.js +1 -1
- package/dist/umd/vest.development.js +279 -277
- package/dist/umd/vest.production.js +1 -1
- package/package.json +1 -1
- package/testUtils/mockThrowError.ts +3 -6
- package/testUtils/suiteDummy.ts +5 -5
- package/types/classnames.d.ts +9 -8
- package/types/parser.d.ts +9 -8
- package/types/promisify.d.ts +9 -8
- package/types/vest.d.ts +69 -68
|
@@ -8,11 +8,26 @@
|
|
|
8
8
|
return typeof value === 'function';
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
function optionalFunctionValue(value) {
|
|
12
|
+
var args = [];
|
|
13
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
14
|
+
args[_i - 1] = arguments[_i];
|
|
15
|
+
}
|
|
16
|
+
return isFunction(value) ? value.apply(void 0, args) : value;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function invariant(condition,
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
21
|
+
message) {
|
|
22
|
+
if (condition) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
// If message is a string object (rather than string literal)
|
|
26
|
+
// Throw the value directly as a string
|
|
27
|
+
// Alternatively, throw an error with the message
|
|
28
|
+
throw message instanceof String
|
|
29
|
+
? message.valueOf()
|
|
30
|
+
: new Error(message ? optionalFunctionValue(message) : message);
|
|
16
31
|
}
|
|
17
32
|
|
|
18
33
|
var promisify = function (validatorFn) {
|
|
@@ -21,9 +36,7 @@
|
|
|
21
36
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
22
37
|
args[_i] = arguments[_i];
|
|
23
38
|
}
|
|
24
|
-
|
|
25
|
-
throwError('promisify: Expected validatorFn to be a function.');
|
|
26
|
-
}
|
|
39
|
+
invariant(isFunction(validatorFn), 'promisify: Expected validatorFn to be a function.');
|
|
27
40
|
return new Promise(function (resolve) { return validatorFn.apply(void 0, args).done(resolve); });
|
|
28
41
|
};
|
|
29
42
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";!function(n,
|
|
1
|
+
"use strict";!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(n="undefined"!=typeof globalThis?globalThis:n||self).promisify=e()}(this,(function(){function n(n,e){if(!n)throw e instanceof String?e.valueOf():Error(e?function(n){for(var e=[],o=1;o<arguments.length;o++)e[o-1]=arguments[o];return"function"==typeof n?n.apply(void 0,e):n}(e):e)}return function(e){return function(){for(var o=[],t=0;t<arguments.length;t++)o[t]=arguments[t];return n("function"==typeof e,"promisify: Expected validatorFn to be a function."),new Promise((function(n){return e.apply(void 0,o).done(n)}))}}}));
|