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.
Files changed (35) hide show
  1. package/dist/cjs/classnames.development.js +21 -8
  2. package/dist/cjs/classnames.production.js +1 -1
  3. package/dist/cjs/enforce/compose.development.js +27 -59
  4. package/dist/cjs/enforce/compose.production.js +1 -1
  5. package/dist/cjs/promisify.development.js +21 -8
  6. package/dist/cjs/promisify.production.js +1 -1
  7. package/dist/cjs/vest.development.js +322 -313
  8. package/dist/cjs/vest.production.js +1 -1
  9. package/dist/es/classnames.development.js +21 -8
  10. package/dist/es/classnames.production.js +1 -1
  11. package/dist/es/enforce/compose.development.js +27 -59
  12. package/dist/es/enforce/compose.production.js +1 -1
  13. package/dist/es/promisify.development.js +21 -8
  14. package/dist/es/promisify.production.js +1 -1
  15. package/dist/es/vest.development.js +322 -313
  16. package/dist/es/vest.production.js +1 -1
  17. package/dist/umd/classnames.development.js +21 -8
  18. package/dist/umd/classnames.production.js +1 -1
  19. package/dist/umd/enforce/compose.development.js +73 -83
  20. package/dist/umd/enforce/compose.production.js +1 -1
  21. package/dist/umd/enforce/compounds.development.js +18 -20
  22. package/dist/umd/enforce/compounds.production.js +1 -1
  23. package/dist/umd/enforce/schema.development.js +18 -20
  24. package/dist/umd/enforce/schema.production.js +1 -1
  25. package/dist/umd/promisify.development.js +21 -8
  26. package/dist/umd/promisify.production.js +1 -1
  27. package/dist/umd/vest.development.js +279 -277
  28. package/dist/umd/vest.production.js +1 -1
  29. package/package.json +1 -1
  30. package/testUtils/mockThrowError.ts +3 -6
  31. package/testUtils/suiteDummy.ts +5 -5
  32. package/types/classnames.d.ts +9 -8
  33. package/types/parser.d.ts +9 -8
  34. package/types/promisify.d.ts +9 -8
  35. package/types/vest.d.ts +69 -68
@@ -8,11 +8,26 @@
8
8
  return typeof value === 'function';
9
9
  }
10
10
 
11
- /**
12
- * Throws a timed out error.
13
- */
14
- function throwError(devMessage, productionMessage) {
15
- throw new Error(devMessage );
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
- if (!isFunction(validatorFn)) {
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,o){"object"==typeof exports&&"undefined"!=typeof module?module.exports=o():"function"==typeof define&&define.amd?define(o):(n="undefined"!=typeof globalThis?globalThis:n||self).promisify=o()}(this,(function(){function n(n,o){var e;return null!==(e=function(n){for(var o=[],e=1;e<arguments.length;e++)o[e-1]=arguments[e];return"function"==typeof n?n.apply(void 0,o):n}(n))&&void 0!==e?e:o}return function(o){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if("function"!=typeof o)throw Error(n(void 0,"promisify: Expected validatorFn to be a function."));return new Promise((function(n){return o.apply(void 0,e).done(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)}))}}}));