vest 4.4.3-dev-c786f7 → 4.6.0
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 +13 -36
- package/dist/cjs/classnames.production.js +1 -1
- package/dist/cjs/parser.development.js +13 -36
- package/dist/cjs/parser.production.js +1 -1
- package/dist/cjs/vest.development.js +232 -187
- package/dist/cjs/vest.production.js +1 -1
- package/dist/es/classnames.development.js +14 -37
- package/dist/es/classnames.production.js +1 -1
- package/dist/es/parser.development.js +14 -37
- package/dist/es/parser.production.js +1 -1
- package/dist/es/vest.development.js +233 -189
- package/dist/es/vest.production.js +1 -1
- package/dist/umd/classnames.development.js +19 -96
- package/dist/umd/classnames.production.js +1 -1
- package/dist/umd/enforce/compose.development.js +9 -665
- package/dist/umd/enforce/compose.production.js +1 -1
- package/dist/umd/enforce/compounds.development.js +17 -667
- package/dist/umd/enforce/compounds.production.js +1 -1
- package/dist/umd/enforce/schema.development.js +12 -668
- package/dist/umd/enforce/schema.production.js +1 -1
- package/dist/umd/parser.development.js +18 -95
- package/dist/umd/parser.production.js +1 -1
- package/dist/umd/promisify.development.js +5 -31
- package/dist/umd/promisify.production.js +1 -1
- package/dist/umd/vest.development.js +336 -1067
- package/dist/umd/vest.production.js +1 -1
- package/package.json +4 -4
- package/types/enforce/compose.d.ts +2 -1
- package/types/enforce/compounds.d.ts +8 -9
- package/types/enforce/schema.d.ts +7 -5
- package/types/parser.d.ts +8 -7
- package/types/promisify.d.ts +20 -35
- package/types/vest.d.ts +79 -81
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";!function(n
|
|
1
|
+
"use strict";!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("n4s"),require("vest-utils")):"function"==typeof define&&define.amd?define(["exports","n4s","vest-utils"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).schema={},e.n4s,e["vest-utils"])}(this,(function(e,n,t){function r(e,n){return e={pass:e},n&&(e.message=n),e}function u(e,n){try{return e.run(n)}catch(e){return r(!1)}}function i(e,t){var i,o=function(r){var i=e[r],o=t[r];if(!(r=n.ctx.run({value:i,set:!0,meta:{key:r}},(function(){return u(o,i)}))).pass)return{value:r}};for(i in t){var s=o(i);if("object"==typeof s)return s.value}return r(!0)}n.enforce.extend({isArrayOf:function(e,i){return t.defaultTo(t.mapFirst(e,(function(e,t,r){t(!(r=n.ctx.run({value:e,set:!0,meta:{index:r}},(function(){return u(i,e)}))).pass,r)})),r(!0))},loose:i,optional:function(e,n){return t.isNullish(e)?r(!0):u(n,e)},shape:function(e,n){var u=i(e,n);if(!u.pass)return u;for(var o in e)if(!t.hasOwnProperty(n,o))return r(!1);return r(!0)}}),e.partial=function(e){var t,r={};for(t in e)r[t]=n.enforce.optional(e[t]);return r},Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
@@ -1,113 +1,36 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.parser = {}));
|
|
5
|
-
}(this, (function (exports) { 'use strict';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var
|
|
11
|
-
return Boolean(result);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
function greaterThan(value, gt) {
|
|
15
|
-
return isNumeric(value) && isNumeric(gt) && Number(value) > Number(gt);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function isFunction(value) {
|
|
19
|
-
return typeof value === 'function';
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function optionalFunctionValue(value) {
|
|
23
|
-
var args = [];
|
|
24
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
|
25
|
-
args[_i - 1] = arguments[_i];
|
|
26
|
-
}
|
|
27
|
-
return isFunction(value) ? value.apply(void 0, args) : value;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function defaultTo(value, defaultValue) {
|
|
31
|
-
var _a;
|
|
32
|
-
return (_a = optionalFunctionValue(value)) !== null && _a !== void 0 ? _a : optionalFunctionValue(defaultValue);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* A safe hasOwnProperty access
|
|
37
|
-
*/
|
|
38
|
-
function hasOwnProperty(obj, key) {
|
|
39
|
-
return Object.prototype.hasOwnProperty.call(obj, key);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function invariant(condition,
|
|
43
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
44
|
-
message) {
|
|
45
|
-
if (condition) {
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
// If message is a string object (rather than string literal)
|
|
49
|
-
// Throw the value directly as a string
|
|
50
|
-
// Alternatively, throw an error with the message
|
|
51
|
-
throw message instanceof String
|
|
52
|
-
? message.valueOf()
|
|
53
|
-
: new Error(message ? optionalFunctionValue(message) : message);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function isPositive(value) {
|
|
57
|
-
return greaterThan(value, 0);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
var Severity;
|
|
61
|
-
(function (Severity) {
|
|
62
|
-
Severity["WARNINGS"] = "warnings";
|
|
63
|
-
Severity["ERRORS"] = "errors";
|
|
64
|
-
})(Severity || (Severity = {}));
|
|
65
|
-
var SeverityCount;
|
|
66
|
-
(function (SeverityCount) {
|
|
67
|
-
SeverityCount["ERROR_COUNT"] = "errorCount";
|
|
68
|
-
SeverityCount["WARN_COUNT"] = "warnCount";
|
|
69
|
-
})(SeverityCount || (SeverityCount = {}));
|
|
70
|
-
|
|
71
|
-
// eslint-disable-next-line max-lines-per-function
|
|
72
|
-
function parse(res) {
|
|
73
|
-
invariant(res && hasOwnProperty(res, 'valid'), "Vest parser: expected argument at position 0 to be Vest's result object.");
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vest'), require('vest-utils')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'vest', 'vest-utils'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.parser = {}, global.vest, global['vest-utils']));
|
|
5
|
+
}(this, (function (exports, vest, vestUtils) { 'use strict';
|
|
6
|
+
|
|
7
|
+
// eslint-disable-next-line max-statements
|
|
8
|
+
function parse(summary) {
|
|
9
|
+
vestUtils.invariant(summary && vestUtils.hasOwnProperty(summary, 'valid'), "Vest parser: expected argument at position 0 to be Vest's result object.");
|
|
10
|
+
var sel = vest.suiteSelectors(summary);
|
|
74
11
|
var testedStorage = {};
|
|
75
12
|
var selectors = {
|
|
76
|
-
invalid: hasErrors,
|
|
13
|
+
invalid: sel.hasErrors,
|
|
77
14
|
tested: isTested,
|
|
78
15
|
untested: isUntested,
|
|
79
|
-
valid: isValid,
|
|
80
|
-
warning: hasWarnings
|
|
16
|
+
valid: sel.isValid,
|
|
17
|
+
warning: sel.hasWarnings
|
|
81
18
|
};
|
|
82
19
|
return selectors;
|
|
20
|
+
// Booleans
|
|
83
21
|
function isTested(fieldName) {
|
|
84
22
|
if (!fieldName) {
|
|
85
|
-
return isPositive(
|
|
23
|
+
return vestUtils.isPositive(summary.testCount);
|
|
86
24
|
}
|
|
87
|
-
if (hasOwnProperty(testedStorage, fieldName))
|
|
25
|
+
if (vestUtils.hasOwnProperty(testedStorage, fieldName))
|
|
88
26
|
return testedStorage[fieldName];
|
|
89
27
|
testedStorage[fieldName] =
|
|
90
|
-
hasOwnProperty(
|
|
91
|
-
isPositive(
|
|
28
|
+
vestUtils.hasOwnProperty(summary.tests, fieldName) &&
|
|
29
|
+
vestUtils.isPositive(summary.tests[fieldName].testCount);
|
|
92
30
|
return selectors.tested(fieldName);
|
|
93
31
|
}
|
|
94
32
|
function isUntested(fieldName) {
|
|
95
|
-
return
|
|
96
|
-
}
|
|
97
|
-
function isValid(fieldName) {
|
|
98
|
-
var _a;
|
|
99
|
-
return fieldName ? Boolean((_a = res.tests[fieldName]) === null || _a === void 0 ? void 0 : _a.valid) : res.valid;
|
|
100
|
-
}
|
|
101
|
-
function hasWarnings(fieldName) {
|
|
102
|
-
return hasFailures(SeverityCount.WARN_COUNT, fieldName);
|
|
103
|
-
}
|
|
104
|
-
function hasErrors(fieldName) {
|
|
105
|
-
return hasFailures(SeverityCount.ERROR_COUNT, fieldName);
|
|
106
|
-
}
|
|
107
|
-
function hasFailures(countKey, fieldName) {
|
|
108
|
-
var _a;
|
|
109
|
-
var failureCount = defaultTo(fieldName ? (_a = res.tests[fieldName]) === null || _a === void 0 ? void 0 : _a[countKey] : res[countKey], 0);
|
|
110
|
-
return isPositive(failureCount);
|
|
33
|
+
return !(vestUtils.isPositive(summary.testCount) && selectors.tested(fieldName));
|
|
111
34
|
}
|
|
112
35
|
}
|
|
113
36
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";!function(t
|
|
1
|
+
"use strict";!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vest"),require("vest-utils")):"function"==typeof define&&define.amd?define(["exports","vest","vest-utils"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).parser={},e.vest,e["vest-utils"])}(this,(function(e,t,s){e.parse=function(e){s.invariant(e&&s.hasOwnProperty(e,"valid"),"Vest parser: expected argument at position 0 to be Vest's result object.");var i=t.suiteSelectors(e),n={},r={invalid:i.hasErrors,tested:function(t){return t?s.hasOwnProperty(n,t)?n[t]:(n[t]=s.hasOwnProperty(e.tests,t)&&s.isPositive(e.tests[t].testCount),r.tested(t)):s.isPositive(e.testCount)},untested:function(t){return!(s.isPositive(e.testCount)&&r.tested(t))},valid:i.isValid,warning:i.hasWarnings};return r},Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
@@ -1,34 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.promisify = factory());
|
|
5
|
-
}(this, (function () { 'use strict';
|
|
6
|
-
|
|
7
|
-
function isFunction(value) {
|
|
8
|
-
return typeof value === 'function';
|
|
9
|
-
}
|
|
10
|
-
|
|
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);
|
|
31
|
-
}
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('vest-utils')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['vest-utils'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.promisify = factory(global['vest-utils']));
|
|
5
|
+
}(this, (function (vestUtils) { 'use strict';
|
|
32
6
|
|
|
33
7
|
var promisify = function (validatorFn) {
|
|
34
8
|
return function () {
|
|
@@ -36,7 +10,7 @@
|
|
|
36
10
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
37
11
|
args[_i] = arguments[_i];
|
|
38
12
|
}
|
|
39
|
-
invariant(isFunction(validatorFn), 'promisify: Expected validatorFn to be a function.');
|
|
13
|
+
vestUtils.invariant(vestUtils.isFunction(validatorFn), 'promisify: Expected validatorFn to be a function.');
|
|
40
14
|
return new Promise(function (resolve) { return validatorFn.apply(void 0, args).done(resolve); });
|
|
41
15
|
};
|
|
42
16
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";!function(n
|
|
1
|
+
"use strict";!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n(require("vest-utils")):"function"==typeof define&&define.amd?define(["vest-utils"],n):(e="undefined"!=typeof globalThis?globalThis:e||self).promisify=n(e["vest-utils"])}(this,(function(e){return function(n){return function(){for(var t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];return e.invariant(e.isFunction(n),"promisify: Expected validatorFn to be a function."),new Promise((function(e){return n.apply(void 0,t).done(e)}))}}}));
|