vest 4.3.1 → 4.3.3
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 -18
- package/dist/cjs/classnames.production.js +1 -1
- package/dist/cjs/enforce/compounds.development.js +3 -3
- package/dist/cjs/enforce/compounds.production.js +1 -1
- package/dist/cjs/parser.development.js +21 -18
- package/dist/cjs/parser.production.js +1 -1
- package/dist/cjs/vest.development.js +166 -170
- package/dist/cjs/vest.production.js +1 -1
- package/dist/es/classnames.development.js +21 -18
- package/dist/es/classnames.production.js +1 -1
- package/dist/es/enforce/compounds.development.js +3 -3
- package/dist/es/enforce/compounds.production.js +1 -1
- package/dist/es/parser.development.js +21 -18
- package/dist/es/parser.production.js +1 -1
- package/dist/es/vest.development.js +166 -170
- package/dist/es/vest.production.js +1 -1
- package/dist/umd/classnames.development.js +21 -18
- package/dist/umd/classnames.production.js +1 -1
- package/dist/umd/enforce/compose.development.js +12 -8
- package/dist/umd/enforce/compose.production.js +1 -1
- package/dist/umd/enforce/compounds.development.js +15 -11
- package/dist/umd/enforce/compounds.production.js +1 -1
- package/dist/umd/enforce/schema.development.js +12 -8
- package/dist/umd/enforce/schema.production.js +1 -1
- package/dist/umd/parser.development.js +21 -18
- package/dist/umd/parser.production.js +1 -1
- package/dist/umd/vest.development.js +171 -175
- package/dist/umd/vest.production.js +1 -1
- package/package.json +3 -3
- package/types/classnames.d.ts +9 -5
- package/types/parser.d.ts +9 -5
- package/types/promisify.d.ts +9 -5
- package/types/vest.d.ts +14 -7
|
@@ -4,13 +4,6 @@ function isFunction(value) {
|
|
|
4
4
|
return typeof value === 'function';
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
-
/**
|
|
8
|
-
* A safe hasOwnProperty access
|
|
9
|
-
*/
|
|
10
|
-
function hasOwnProperty(obj, key) {
|
|
11
|
-
return Object.prototype.hasOwnProperty.call(obj, key);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
7
|
function optionalFunctionValue(value) {
|
|
15
8
|
var args = [];
|
|
16
9
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
@@ -19,6 +12,18 @@ function optionalFunctionValue(value) {
|
|
|
19
12
|
return isFunction(value) ? value.apply(void 0, args) : value;
|
|
20
13
|
}
|
|
21
14
|
|
|
15
|
+
function defaultTo(callback, defaultValue) {
|
|
16
|
+
var _a;
|
|
17
|
+
return (_a = optionalFunctionValue(callback)) !== null && _a !== void 0 ? _a : defaultValue;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* A safe hasOwnProperty access
|
|
22
|
+
*/
|
|
23
|
+
function hasOwnProperty(obj, key) {
|
|
24
|
+
return Object.prototype.hasOwnProperty.call(obj, key);
|
|
25
|
+
}
|
|
26
|
+
|
|
22
27
|
function invariant(condition,
|
|
23
28
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
24
29
|
message) {
|
|
@@ -86,22 +91,20 @@ function parse(res) {
|
|
|
86
91
|
return res.testCount === 0 || !selectors.tested(fieldName);
|
|
87
92
|
}
|
|
88
93
|
function isValid(fieldName) {
|
|
89
|
-
var _a
|
|
90
|
-
return
|
|
94
|
+
var _a;
|
|
95
|
+
return fieldName ? Boolean((_a = res.tests[fieldName]) === null || _a === void 0 ? void 0 : _a.valid) : res.valid;
|
|
91
96
|
}
|
|
92
97
|
function hasWarnings(fieldName) {
|
|
93
|
-
return hasFailures(
|
|
98
|
+
return hasFailures(SeverityCount.WARN_COUNT, fieldName);
|
|
94
99
|
}
|
|
95
100
|
function hasErrors(fieldName) {
|
|
96
|
-
return hasFailures(
|
|
101
|
+
return hasFailures(SeverityCount.ERROR_COUNT, fieldName);
|
|
102
|
+
}
|
|
103
|
+
function hasFailures(countKey, fieldName) {
|
|
104
|
+
var _a;
|
|
105
|
+
var failureCount = defaultTo(fieldName ? (_a = res.tests[fieldName]) === null || _a === void 0 ? void 0 : _a[countKey] : res[countKey], 0);
|
|
106
|
+
return isPositive(failureCount);
|
|
97
107
|
}
|
|
98
|
-
}
|
|
99
|
-
function hasFailures(res, countKey, fieldName) {
|
|
100
|
-
var _a, _b, _c;
|
|
101
|
-
var failureCount = fieldName
|
|
102
|
-
? (_b = (_a = res.tests) === null || _a === void 0 ? void 0 : _a[fieldName]) === null || _b === void 0 ? void 0 : _b[countKey]
|
|
103
|
-
: (_c = res[countKey]) !== null && _c !== void 0 ? _c : 0;
|
|
104
|
-
return isPositive(failureCount);
|
|
105
108
|
}
|
|
106
109
|
|
|
107
110
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function t(t){return"function"==typeof t}function n(
|
|
1
|
+
"use strict";function t(t){return"function"==typeof t}function n(n){for(var r=[],e=1;e<arguments.length;e++)r[e-1]=arguments[e];return t(n)?n.apply(void 0,r):n}function r(t,n){return Object.prototype.hasOwnProperty.call(t,n)}function e(t){var n=Number(t);return!(isNaN(parseFloat(String(t)))||isNaN(Number(t))||!isFinite(n))}function u(t){return function(t,n){return e(t)&&e(n)&&Number(t)>Number(n)}(t,0)}var o,i,s;function a(t){function e(r,e){var o;return u(r=function(t,r){var e;return null!==(e=n(t))&&void 0!==e?e:r}(e?null===(o=t.tests[e])||void 0===o?void 0:o[r]:t[r],0))}!function(t,r){if(!t)throw r instanceof String?r.valueOf():Error(r?n(r):r)}(t&&r(t,"valid"),"Vest parser: expected argument at position 0 to be Vest's result object.");var o={},i={invalid:function(t){return e(s.ERROR_COUNT,t)},tested:function(n){return n?r(o,n)?o[n]:(o[n]=r(t.tests,n)&&u(t.tests[n].testCount),i.tested(n)):u(t.testCount)},untested:function(n){return 0===t.testCount||!i.tested(n)},valid:function(n){var r;return n?!(null===(r=t.tests[n])||void 0===r||!r.valid):t.valid},warning:function(t){return e(s.WARN_COUNT,t)}};return i}(i=o||(o={})).WARNINGS="warnings",i.ERRORS="errors",function(t){t.ERROR_COUNT="errorCount",t.WARN_COUNT="warnCount"}(s||(s={})),module.exports=function(n,r){void 0===r&&(r={});var e=a(n);return function(n){var u,o=[];for(u in r){var i=u;t(e[i])&&e[i](n)&&o.push(r[i])}return o.join(" ")}};
|
|
@@ -133,13 +133,13 @@ function oneOf(value) {
|
|
|
133
133
|
}
|
|
134
134
|
var passing = [];
|
|
135
135
|
rules.some(function (rule) {
|
|
136
|
-
if (longerThan(passing, REQUIRED_COUNT)) {
|
|
137
|
-
return false;
|
|
138
|
-
}
|
|
139
136
|
var res = runLazyRule(rule, value);
|
|
140
137
|
if (res.pass) {
|
|
141
138
|
passing.push(res);
|
|
142
139
|
}
|
|
140
|
+
if (longerThan(passing, REQUIRED_COUNT)) {
|
|
141
|
+
return false;
|
|
142
|
+
}
|
|
143
143
|
});
|
|
144
144
|
return ruleReturn(lengthEquals(passing, REQUIRED_COUNT));
|
|
145
145
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var n=require("n4s");function r(n,r){function t(n){u=!0,e=n}for(var u=!1,e=null,f=0;f<n.length;f++)if(r(n[f],t,f),u)return e}function t(n){return"function"==typeof n}function u(n,r){var u;return null!==(u=function(n){for(var r=[],u=1;u<arguments.length;u++)r[u-1]=arguments[u];return t(n)?n.apply(void 0,r):n}(n))&&void 0!==u?u:r}function e(n,r){return n={pass:n},r&&(n.message=r),n}function f(){return e(!1)}function o(n){return u(n,f())}function i(n){return u(n,e(!0))}function c(n,r){try{return n.run(r)}catch(n){return f()}}function a(n){var r=Number(n);return!(isNaN(parseFloat(String(n)))||isNaN(Number(n))||!isFinite(r))}function s(n,r){return function(n,r){return a(n)&&a(r)&&Number(n)===Number(r)}(n.length,r)}function l(n,r){return function(n,r){return a(n)&&a(r)&&Number(n)>Number(r)}(n.length,r)}n.enforce.extend({allOf:function(n){for(var t=[],u=1;u<arguments.length;u++)t[u-1]=arguments[u];return i(r(t,(function(r,t){(r=c(r,n)).pass||t(r)})))},anyOf:function(n){for(var t=[],u=1;u<arguments.length;u++)t[u-1]=arguments[u];return o(r(t,(function(r,t){(r=c(r,n)).pass&&t(r)})))},noneOf:function(n){for(var t=[],u=1;u<arguments.length;u++)t[u-1]=arguments[u];return i(r(t,(function(r,t){c(r,n).pass&&t(f())})))},oneOf:function(n){for(var r=[],t=1;t<arguments.length;t++)r[t-1]=arguments[t];var u=[];return r.some((function(r){if(
|
|
1
|
+
"use strict";var n=require("n4s");function r(n,r){function t(n){u=!0,e=n}for(var u=!1,e=null,f=0;f<n.length;f++)if(r(n[f],t,f),u)return e}function t(n){return"function"==typeof n}function u(n,r){var u;return null!==(u=function(n){for(var r=[],u=1;u<arguments.length;u++)r[u-1]=arguments[u];return t(n)?n.apply(void 0,r):n}(n))&&void 0!==u?u:r}function e(n,r){return n={pass:n},r&&(n.message=r),n}function f(){return e(!1)}function o(n){return u(n,f())}function i(n){return u(n,e(!0))}function c(n,r){try{return n.run(r)}catch(n){return f()}}function a(n){var r=Number(n);return!(isNaN(parseFloat(String(n)))||isNaN(Number(n))||!isFinite(r))}function s(n,r){return function(n,r){return a(n)&&a(r)&&Number(n)===Number(r)}(n.length,r)}function l(n,r){return function(n,r){return a(n)&&a(r)&&Number(n)>Number(r)}(n.length,r)}n.enforce.extend({allOf:function(n){for(var t=[],u=1;u<arguments.length;u++)t[u-1]=arguments[u];return i(r(t,(function(r,t){(r=c(r,n)).pass||t(r)})))},anyOf:function(n){for(var t=[],u=1;u<arguments.length;u++)t[u-1]=arguments[u];return o(r(t,(function(r,t){(r=c(r,n)).pass&&t(r)})))},noneOf:function(n){for(var t=[],u=1;u<arguments.length;u++)t[u-1]=arguments[u];return i(r(t,(function(r,t){c(r,n).pass&&t(f())})))},oneOf:function(n){for(var r=[],t=1;t<arguments.length;t++)r[t-1]=arguments[t];var u=[];return r.some((function(r){if((r=c(r,n)).pass&&u.push(r),l(u,1))return!1})),e(s(u,1))}});
|
|
@@ -2,13 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
/**
|
|
6
|
-
* A safe hasOwnProperty access
|
|
7
|
-
*/
|
|
8
|
-
function hasOwnProperty(obj, key) {
|
|
9
|
-
return Object.prototype.hasOwnProperty.call(obj, key);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
5
|
function isFunction(value) {
|
|
13
6
|
return typeof value === 'function';
|
|
14
7
|
}
|
|
@@ -21,6 +14,18 @@ function optionalFunctionValue(value) {
|
|
|
21
14
|
return isFunction(value) ? value.apply(void 0, args) : value;
|
|
22
15
|
}
|
|
23
16
|
|
|
17
|
+
function defaultTo(callback, defaultValue) {
|
|
18
|
+
var _a;
|
|
19
|
+
return (_a = optionalFunctionValue(callback)) !== null && _a !== void 0 ? _a : defaultValue;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* A safe hasOwnProperty access
|
|
24
|
+
*/
|
|
25
|
+
function hasOwnProperty(obj, key) {
|
|
26
|
+
return Object.prototype.hasOwnProperty.call(obj, key);
|
|
27
|
+
}
|
|
28
|
+
|
|
24
29
|
function invariant(condition,
|
|
25
30
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
26
31
|
message) {
|
|
@@ -88,22 +93,20 @@ function parse(res) {
|
|
|
88
93
|
return res.testCount === 0 || !selectors.tested(fieldName);
|
|
89
94
|
}
|
|
90
95
|
function isValid(fieldName) {
|
|
91
|
-
var _a
|
|
92
|
-
return
|
|
96
|
+
var _a;
|
|
97
|
+
return fieldName ? Boolean((_a = res.tests[fieldName]) === null || _a === void 0 ? void 0 : _a.valid) : res.valid;
|
|
93
98
|
}
|
|
94
99
|
function hasWarnings(fieldName) {
|
|
95
|
-
return hasFailures(
|
|
100
|
+
return hasFailures(SeverityCount.WARN_COUNT, fieldName);
|
|
96
101
|
}
|
|
97
102
|
function hasErrors(fieldName) {
|
|
98
|
-
return hasFailures(
|
|
103
|
+
return hasFailures(SeverityCount.ERROR_COUNT, fieldName);
|
|
104
|
+
}
|
|
105
|
+
function hasFailures(countKey, fieldName) {
|
|
106
|
+
var _a;
|
|
107
|
+
var failureCount = defaultTo(fieldName ? (_a = res.tests[fieldName]) === null || _a === void 0 ? void 0 : _a[countKey] : res[countKey], 0);
|
|
108
|
+
return isPositive(failureCount);
|
|
99
109
|
}
|
|
100
|
-
}
|
|
101
|
-
function hasFailures(res, countKey, fieldName) {
|
|
102
|
-
var _a, _b, _c;
|
|
103
|
-
var failureCount = fieldName
|
|
104
|
-
? (_b = (_a = res.tests) === null || _a === void 0 ? void 0 : _a[fieldName]) === null || _b === void 0 ? void 0 : _b[countKey]
|
|
105
|
-
: (_c = res[countKey]) !== null && _c !== void 0 ? _c : 0;
|
|
106
|
-
return isPositive(failureCount);
|
|
107
110
|
}
|
|
108
111
|
|
|
109
112
|
exports.parse = parse;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function t(t
|
|
1
|
+
"use strict";function t(t){return"function"==typeof t}function n(n){for(var r=[],e=1;e<arguments.length;e++)r[e-1]=arguments[e];return t(n)?n.apply(void 0,r):n}function r(t,n){return Object.prototype.hasOwnProperty.call(t,n)}function e(t){var n=Number(t);return!(isNaN(parseFloat(String(t)))||isNaN(Number(t))||!isFinite(n))}function u(t){return function(t,n){return e(t)&&e(n)&&Number(t)>Number(n)}(t,0)}var o,i,s;Object.defineProperty(exports,"__esModule",{value:!0}),(i=o||(o={})).WARNINGS="warnings",i.ERRORS="errors",function(t){t.ERROR_COUNT="errorCount",t.WARN_COUNT="warnCount"}(s||(s={})),exports.parse=function(t){function e(r,e){var o;return u(r=function(t,r){var e;return null!==(e=n(t))&&void 0!==e?e:r}(e?null===(o=t.tests[e])||void 0===o?void 0:o[r]:t[r],0))}!function(t,r){if(!t)throw r instanceof String?r.valueOf():Error(r?n(r):r)}(t&&r(t,"valid"),"Vest parser: expected argument at position 0 to be Vest's result object.");var o={},i={invalid:function(t){return e(s.ERROR_COUNT,t)},tested:function(n){return n?r(o,n)?o[n]:(o[n]=r(t.tests,n)&&u(t.tests[n].testCount),i.tested(n)):u(t.testCount)},untested:function(n){return 0===t.testCount||!i.tested(n)},valid:function(n){var r;return n?!(null===(r=t.tests[n])||void 0===r||!r.valid):t.valid},warning:function(t){return e(s.WARN_COUNT,t)}};return i};
|