vest 4.0.0-dev-366a8b → 4.0.0-next-cfb1a7
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/CHANGELOG.md +58 -49
- package/dist/cjs/classnames.development.js +3 -3
- package/dist/cjs/classnames.production.js +1 -1
- package/dist/cjs/enforce-compose.development.js +222 -0
- package/dist/cjs/enforce-compose.js +7 -0
- package/dist/cjs/enforce-compose.production.js +1 -0
- package/dist/cjs/promisify.development.js +1 -1
- package/dist/cjs/promisify.production.js +1 -1
- package/dist/cjs/vest.development.js +168 -107
- package/dist/cjs/vest.production.js +1 -1
- package/dist/es/classnames.development.js +3 -3
- package/dist/es/classnames.production.js +1 -1
- package/dist/es/enforce-compose.development.js +220 -0
- package/dist/es/enforce-compose.production.js +1 -0
- package/dist/es/promisify.development.js +1 -1
- package/dist/es/promisify.production.js +1 -1
- package/dist/es/vest.development.js +168 -107
- package/dist/es/vest.production.js +1 -1
- package/dist/umd/classnames.development.js +3 -3
- package/dist/umd/classnames.production.js +1 -1
- package/dist/umd/enforce-compose.development.js +228 -0
- package/dist/umd/enforce-compose.production.js +1 -0
- package/dist/umd/promisify.development.js +1 -1
- package/dist/umd/promisify.production.js +1 -1
- package/dist/umd/vest.development.js +168 -107
- package/dist/umd/vest.production.js +1 -1
- package/enforce-compose/package.json +7 -0
- package/package.json +31 -1
- package/types/classnames.d.ts +2 -2
- package/types/enforce-compose.d.ts +12 -0
- package/types/vest.d.ts +23 -7
- package/docs/.nojekyll +0 -0
- package/docs/README.md +0 -113
- package/docs/_assets/favicon.ico +0 -0
- package/docs/_assets/vest-logo.png +0 -0
- package/docs/_sidebar.md +0 -14
- package/docs/cross_field_validations.md +0 -33
- package/docs/enforce.md +0 -11
- package/docs/exclusion.md +0 -129
- package/docs/getting_started.md +0 -72
- package/docs/group.md +0 -142
- package/docs/index.html +0 -41
- package/docs/migration.md +0 -202
- package/docs/n4s/rules.md +0 -1282
- package/docs/node.md +0 -36
- package/docs/optional.md +0 -103
- package/docs/result.md +0 -249
- package/docs/state.md +0 -102
- package/docs/test.md +0 -172
- package/docs/utilities.md +0 -109
- package/docs/warn.md +0 -82
package/CHANGELOG.md
CHANGED
|
@@ -4,72 +4,81 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
|
|
5
5
|
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
-
## 4.0.0 - 2021-10
|
|
7
|
+
## 4.0.0 - 2021-11-10
|
|
8
8
|
### Changed or removed
|
|
9
|
-
-
|
|
10
|
-
-
|
|
9
|
+
- 31f7185 major(context): used named export in context (ealush)
|
|
10
|
+
- f789154 breaking(vest, enforce): prepare next major (ealush)
|
|
11
|
+
- 72eecb5 breaking(vest, enforce): prepare next major (ealush)
|
|
11
12
|
|
|
12
13
|
### Added
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
14
|
+
- ad71cbc feat(vest): support custom optional logic (ealush)
|
|
15
|
+
- e7fd0da feat(vest): Add a parser export (ealush)
|
|
16
|
+
- dd3fe6a feat(vest): isValid with field name (ealush)
|
|
17
|
+
- d0cb5e1 feat(vest): handle execution order state refill with memoized tests (ealush)
|
|
18
|
+
- 6c40b13 feat(vest): Make the state rely on execution order. Make skipWhen set skipped context. (undefined)
|
|
19
|
+
- 89858cd added(n4s): partial rule modifier (undefined)
|
|
20
|
+
- e809f35 feat(n4s): context propagation within enforce (undefined)
|
|
20
21
|
|
|
21
22
|
### Fixed and improved
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
-
-
|
|
27
|
-
-
|
|
28
|
-
-
|
|
29
|
-
-
|
|
30
|
-
-
|
|
31
|
-
-
|
|
32
|
-
-
|
|
33
|
-
-
|
|
34
|
-
-
|
|
35
|
-
-
|
|
36
|
-
-
|
|
37
|
-
-
|
|
38
|
-
-
|
|
39
|
-
-
|
|
40
|
-
-
|
|
23
|
+
- cfb1a7a types(vest): allow unprovided suite name in tests (ealush)
|
|
24
|
+
- 80166b3 patch(vest): replace warns boolean flag with enum (ealush)
|
|
25
|
+
- 94cc21b patch(vest): Pass draft result to skipWhen conditional (ealush)
|
|
26
|
+
- c340eab patch(vest): add back optional suite name argument (ealush)
|
|
27
|
+
- a1f3bc6 patch(vest): make compose an external export (ealush)
|
|
28
|
+
- c78e0c9 patch(vest): move creation functions to event bus (ealush)
|
|
29
|
+
- 6c426e4 patch: Some cleanups (ealush)
|
|
30
|
+
- b76dd3d fix(vest): prevent pending tests from being marked as skipped (ealush)
|
|
31
|
+
- 52bb16d patch(vest): Add isolate module for containing re-orders (ealush)
|
|
32
|
+
- 013bd54 patch(vest): refresh tests after cancel (ealush)
|
|
33
|
+
- a48cb89 patch: add cursor util (ealush)
|
|
34
|
+
- 82a2386 patch(vest): move cursor into context (ealush)
|
|
35
|
+
- 0c529df patch(vest): automatically purge not-found test results (ealush)
|
|
36
|
+
- 14604e0 vx: correctly pass cli options to build script (ealush)
|
|
37
|
+
- d6c3638 patch(vest): Throw error when tests are called in the wrong order (ealush)
|
|
38
|
+
- 3cd07f6 vx: add types to exports (ealush)
|
|
39
|
+
- 083adf1 organize vest state hooks (ealush)
|
|
40
|
+
- ac62b45 patch(vest): infer omitted optional fields (ealush)
|
|
41
|
+
- bb44b7a vx: add dev bundle to exports (ealush)
|
|
42
|
+
- efae31d fix(vest): prevent changing test status once it was finalized (ealush)
|
|
43
|
+
- a2d8c89 patch(vest): add cache invalidation for canceled tests (ealush)
|
|
44
|
+
- 694b88e types(vest): add safeguard around shouldUseErrorAsMessage (ealush)
|
|
45
|
+
- bb23481 patch(vest): some cleanups (ealush)
|
|
46
|
+
- 33bbe52 patch(vest): remove duplicate code handling perv test registration (ealush)
|
|
47
|
+
- f379875 vx: use context directly from published package (ealush)
|
|
48
|
+
- d435f30 patch: run done callbacks via event (ealush)
|
|
49
|
+
- 4e575c2 patch(vest): removed state subscription (ealush)
|
|
41
50
|
- package.json
|
|
42
51
|
- packages/anyone/package.json
|
|
43
52
|
- packages/anyone/package.json
|
|
44
53
|
- packages/vast/types/vast.d.ts
|
|
45
|
-
-
|
|
46
|
-
-
|
|
47
|
-
-
|
|
48
|
-
-
|
|
49
|
-
-
|
|
50
|
-
-
|
|
51
|
-
-
|
|
54
|
+
- ffac5fc patch(vest): remove pending and lagging state (ealush)
|
|
55
|
+
- e803851 patch(vest): convert boolean flags to a single status key (ealush)
|
|
56
|
+
- af9f79b patch: simplify fieldname comparison (ealush)
|
|
57
|
+
- 5a8157f patch(vest): add useAllIncomplete hook (ealush)
|
|
58
|
+
- 7f565ce patch(vest): invalid accounts for warning tests as well (ealush)
|
|
59
|
+
- 3e7cbd3 patch(vest): isValid counts all required tests per field (ealush)
|
|
60
|
+
- 0309a9f chore: cleanups (ealush)
|
|
52
61
|
- .eslintrc.js
|
|
53
|
-
-
|
|
62
|
+
- 9d415e0 add(n4s): enforce.condition (ealush)
|
|
54
63
|
- package.json
|
|
55
64
|
- packages/anyone/package.json
|
|
56
|
-
-
|
|
57
|
-
-
|
|
65
|
+
- 98ea7f3 chore: cleanup residue (undefined)
|
|
66
|
+
- ba3d423 chore: remove duplicate types (undefined)
|
|
58
67
|
- packages/anyone/package.json
|
|
59
|
-
-
|
|
60
|
-
-
|
|
68
|
+
- 4941ab3 patch: add nodejs exports (undefined)
|
|
69
|
+
- 603db2c patch: remove unused exports (undefined)
|
|
61
70
|
- packages/anyone/package.json
|
|
62
|
-
-
|
|
71
|
+
- 1bb9fb9 chore: reduce complexity, remove all lint errors (undefined)
|
|
63
72
|
- packages/anyone/.npmignore
|
|
64
73
|
- .github/PULL_REQUEST_TEMPLATE.md
|
|
65
|
-
-
|
|
66
|
-
-
|
|
74
|
+
- 7ad4c81 chore: cleanup unused code (ealush)
|
|
75
|
+
- 2696ab3 lint: handling lint of all packages (ealush)
|
|
67
76
|
- .gitignore
|
|
68
|
-
-
|
|
69
|
-
-
|
|
70
|
-
-
|
|
71
|
-
-
|
|
72
|
-
-
|
|
77
|
+
- 021c752 patch(n4s): add ruleReturn default values (ealush)
|
|
78
|
+
- a14b02d fix(n4s): make enforce compound runners fall back to correct response (ealush)
|
|
79
|
+
- e70b369 fix(n4s): make enforce chaining work (ealush)
|
|
80
|
+
- b251877 chore: some lint fixes (ealush)
|
|
81
|
+
- c8508e8 add cli options support (ealush)
|
|
73
82
|
|
|
74
83
|
## 3.2.7 - 2021-07-17
|
|
75
84
|
|
|
@@ -56,10 +56,10 @@ function parse(res) {
|
|
|
56
56
|
/**
|
|
57
57
|
* Creates a function that returns class names that match the validation result
|
|
58
58
|
*/
|
|
59
|
-
function
|
|
59
|
+
function classnames(res, classes) {
|
|
60
60
|
if (classes === void 0) { classes = {}; }
|
|
61
61
|
if (!res || !isFunction(res.hasErrors)) {
|
|
62
|
-
throwError("
|
|
62
|
+
throwError("classnames: Expected first argument to be Vest's result object.");
|
|
63
63
|
}
|
|
64
64
|
var selectors = parse(res);
|
|
65
65
|
return function (key) {
|
|
@@ -74,4 +74,4 @@ function classNames(res, classes) {
|
|
|
74
74
|
};
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
module.exports =
|
|
77
|
+
module.exports = classnames;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function t(t){return"function"==typeof t}function r(r,n){var e;return null!==(e=function(r){for(var n=[],e=1;e<arguments.length;e++)n[e-1]=arguments[e];return t(r)?r.apply(void 0,n):r}(r))&&void 0!==e?e:n}function n(t){var r=Number(t);return!(isNaN(parseFloat(String(t)))||isNaN(Number(t))||!isFinite(r))}function e(t,r){return n(t)&&n(r)&&Number(t)>Number(r)}function u(t,r){return Object.prototype.hasOwnProperty.call(t,r)}module.exports=function(n,o){void 0===o&&(o={}),n&&t(n.hasErrors)||function(t,n){throw Error(r(n,t))}("
|
|
1
|
+
"use strict";function t(t){return"function"==typeof t}function r(r,n){var e;return null!==(e=function(r){for(var n=[],e=1;e<arguments.length;e++)n[e-1]=arguments[e];return t(r)?r.apply(void 0,n):r}(r))&&void 0!==e?e:n}function n(t){var r=Number(t);return!(isNaN(parseFloat(String(t)))||isNaN(Number(t))||!isFinite(r))}function e(t,r){return n(t)&&n(r)&&Number(t)>Number(r)}function u(t,r){return Object.prototype.hasOwnProperty.call(t,r)}module.exports=function(n,o){void 0===o&&(o={}),n&&t(n.hasErrors)||function(t,n){throw Error(r(n,t))}("classnames: Expected first argument to be Vest's result object.");var s=function(t){var r={},n={invalid:t.hasErrors,tested:function(o){return o?u(r,o)?r[o]:(r[o]=u(t.tests,o)&&e(t.tests[o].testCount,0),n.tested(o)):e(t.testCount,0)},untested:function(r){return 0===t.testCount||!n.tested(r)},valid:t.isValid,warning:t.hasWarnings};return n}(n);return function(r){var n,e=[];for(n in o){var u=n;t(s[u])&&s[u](r)&&e.push(o[u])}return e.join(" ")}};
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function mapFirst(array, callback) {
|
|
4
|
+
var broke = false;
|
|
5
|
+
var breakoutValue = null;
|
|
6
|
+
for (var i = 0; i < array.length; i++) {
|
|
7
|
+
callback(array[i], breakout, i);
|
|
8
|
+
if (broke) {
|
|
9
|
+
return breakoutValue;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
function breakout(value) {
|
|
13
|
+
broke = true;
|
|
14
|
+
breakoutValue = value;
|
|
15
|
+
}
|
|
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(callback, defaultValue) {
|
|
31
|
+
var _a;
|
|
32
|
+
return (_a = optionalFunctionValue(callback)) !== null && _a !== void 0 ? _a : defaultValue;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Throws a timed out error.
|
|
37
|
+
*/
|
|
38
|
+
function throwError(devMessage, productionMessage) {
|
|
39
|
+
throw new Error(devMessage );
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
var assign = Object.assign;
|
|
43
|
+
|
|
44
|
+
// eslint-disable-next-line max-lines-per-function
|
|
45
|
+
function createContext(init) {
|
|
46
|
+
var storage = { ancestry: [] };
|
|
47
|
+
return {
|
|
48
|
+
bind: bind,
|
|
49
|
+
run: run,
|
|
50
|
+
use: use,
|
|
51
|
+
useX: useX
|
|
52
|
+
};
|
|
53
|
+
function useX(errorMessage) {
|
|
54
|
+
var _a;
|
|
55
|
+
return ((_a = storage.ctx) !== null && _a !== void 0 ? _a : throwError(defaultTo(errorMessage, 'Context was used after it was closed')));
|
|
56
|
+
}
|
|
57
|
+
function run(ctxRef, fn) {
|
|
58
|
+
var _a;
|
|
59
|
+
var parentContext = use();
|
|
60
|
+
var out = assign({}, parentContext ? parentContext : {}, (_a = optionalFunctionValue(init, ctxRef, parentContext)) !== null && _a !== void 0 ? _a : ctxRef);
|
|
61
|
+
var ctx = set(Object.freeze(out));
|
|
62
|
+
storage.ancestry.unshift(ctx);
|
|
63
|
+
var res = fn(ctx);
|
|
64
|
+
clear();
|
|
65
|
+
return res;
|
|
66
|
+
}
|
|
67
|
+
function bind(ctxRef, fn) {
|
|
68
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
69
|
+
// @ts-ignore - this one's pretty hard to get right
|
|
70
|
+
var returnedFn = function () {
|
|
71
|
+
var runTimeArgs = [];
|
|
72
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
73
|
+
runTimeArgs[_i] = arguments[_i];
|
|
74
|
+
}
|
|
75
|
+
return run(ctxRef, function () {
|
|
76
|
+
return fn.apply(void 0, runTimeArgs);
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
return returnedFn;
|
|
80
|
+
}
|
|
81
|
+
function use() {
|
|
82
|
+
return storage.ctx;
|
|
83
|
+
}
|
|
84
|
+
function set(value) {
|
|
85
|
+
return (storage.ctx = value);
|
|
86
|
+
}
|
|
87
|
+
function clear() {
|
|
88
|
+
var _a;
|
|
89
|
+
storage.ancestry.shift();
|
|
90
|
+
set((_a = storage.ancestry[0]) !== null && _a !== void 0 ? _a : null);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
var ctx = createContext(function (ctxRef, parentContext) {
|
|
95
|
+
var base = {
|
|
96
|
+
value: ctxRef.value,
|
|
97
|
+
meta: ctxRef.meta || {}
|
|
98
|
+
};
|
|
99
|
+
if (!parentContext) {
|
|
100
|
+
return assign(base, {
|
|
101
|
+
parent: emptyParent
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
else if (ctxRef.set) {
|
|
105
|
+
return assign(base, {
|
|
106
|
+
parent: function () { return stripContext(parentContext); }
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
return parentContext;
|
|
110
|
+
});
|
|
111
|
+
function stripContext(ctx) {
|
|
112
|
+
if (!ctx) {
|
|
113
|
+
return ctx;
|
|
114
|
+
}
|
|
115
|
+
return {
|
|
116
|
+
value: ctx.value,
|
|
117
|
+
meta: ctx.meta,
|
|
118
|
+
parent: ctx.parent
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
function emptyParent() {
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* A safe hasOwnProperty access
|
|
127
|
+
*/
|
|
128
|
+
function hasOwnProperty(obj, key) {
|
|
129
|
+
return Object.prototype.hasOwnProperty.call(obj, key);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function isNumber(value) {
|
|
133
|
+
return Boolean(typeof value === 'number');
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function lengthEquals(value, arg1) {
|
|
137
|
+
return value.length === Number(arg1);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function isEmpty(value) {
|
|
141
|
+
if (!value) {
|
|
142
|
+
return true;
|
|
143
|
+
}
|
|
144
|
+
else if (isNumber(value)) {
|
|
145
|
+
return value === 0;
|
|
146
|
+
}
|
|
147
|
+
else if (hasOwnProperty(value, 'length')) {
|
|
148
|
+
return lengthEquals(value, 0);
|
|
149
|
+
}
|
|
150
|
+
else if (typeof value === 'object') {
|
|
151
|
+
return lengthEquals(Object.keys(value), 0);
|
|
152
|
+
}
|
|
153
|
+
return true;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
function ruleReturn(pass, message) {
|
|
157
|
+
var output = { pass: pass };
|
|
158
|
+
if (message) {
|
|
159
|
+
output.message = message;
|
|
160
|
+
}
|
|
161
|
+
return output;
|
|
162
|
+
}
|
|
163
|
+
function failing() {
|
|
164
|
+
return ruleReturn(false);
|
|
165
|
+
}
|
|
166
|
+
function passing() {
|
|
167
|
+
return ruleReturn(true);
|
|
168
|
+
}
|
|
169
|
+
function defaultToPassing(callback) {
|
|
170
|
+
return defaultTo(callback, passing());
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
function runLazyRule(lazyRule, currentValue) {
|
|
174
|
+
try {
|
|
175
|
+
return lazyRule.run(currentValue);
|
|
176
|
+
}
|
|
177
|
+
catch (_a) {
|
|
178
|
+
return failing();
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/* eslint-disable max-lines-per-function */
|
|
183
|
+
// TODO: This gives me a headache. Instead of `any` we should use `TLazy`
|
|
184
|
+
// but it fails when using compose. The type is very complex.
|
|
185
|
+
function compose() {
|
|
186
|
+
var composites = [];
|
|
187
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
188
|
+
composites[_i] = arguments[_i];
|
|
189
|
+
}
|
|
190
|
+
return Object.assign(function (value) {
|
|
191
|
+
var res = run(value);
|
|
192
|
+
if (!res.pass) {
|
|
193
|
+
if (isEmpty(res.message)) {
|
|
194
|
+
throwError();
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
// Explicitly throw a string so that vest.test can pick it up as the validation error message
|
|
198
|
+
throw res.message;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}, {
|
|
202
|
+
run: run,
|
|
203
|
+
test: function (value) { return run(value).pass; }
|
|
204
|
+
});
|
|
205
|
+
function run(value) {
|
|
206
|
+
return ctx.run({ value: value }, function () {
|
|
207
|
+
return defaultToPassing(mapFirst(composites, function (composite, breakout) {
|
|
208
|
+
/* HACK: Just a small white lie. ~~HELP WANTED~~.
|
|
209
|
+
The ideal is that instead of `TLazyRuleRunners` We would simply use `TLazy` to begin with.
|
|
210
|
+
The problem is that lazy rules can't really be passed to this function due to some generic hell
|
|
211
|
+
so we're limiting it to a small set of functions.
|
|
212
|
+
*/
|
|
213
|
+
var res = runLazyRule(composite, value);
|
|
214
|
+
if (!res.pass) {
|
|
215
|
+
breakout(res);
|
|
216
|
+
}
|
|
217
|
+
}));
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
module.exports = compose;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";function n(n,t){function r(n){e=!0,u=n}for(var e=!1,u=null,o=0;o<n.length;o++)if(t(n[o],r,o),e)return u}function t(n){return"function"==typeof n}function r(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 e(n,t){var e;return null!==(e=r(n))&&void 0!==e?e:t}function u(n,t){throw Error(e(t,n))}var o=Object.assign;var i=function(n){function t(t,e){var u,f,a=i();return t=o({},a||{},null!==(u=r(n,t,a))&&void 0!==u?u:t),u=c.ctx=Object.freeze(t),c.ancestry.unshift(u),e=e(u),c.ancestry.shift(),c.ctx=null!==(f=c.ancestry[0])&&void 0!==f?f:null,e}function i(){return c.ctx}var c={ancestry:[]};return{bind:function(n,r){return function(){for(var e=[],u=0;u<arguments.length;u++)e[u]=arguments[u];return t(n,(function(){return r.apply(void 0,e)}))}},run:t,use:i,useX:function(n){var t;return null!==(t=c.ctx)&&void 0!==t?t:u(e(n,"Context was used after it was closed"))}}}((function(n,t){var r={value:n.value,meta:n.meta||{}};return t?n.set?o(r,{parent:function(){return function(n){return n?{value:n.value,meta:n.meta,parent:n.parent}:n}(t)}}):t:o(r,{parent:c})}));function c(){return null}function f(n,t){return n.length===Number(t)}function a(n){if(n){if(function(n){return"number"==typeof n}(n))return 0===n;if(function(n,t){return Object.prototype.hasOwnProperty.call(n,t)}(n,"length"))return f(n,0);if("object"==typeof n)return f(Object.keys(n),0)}return!0}function s(n,t){return n={pass:n},t&&(n.message=t),n}function l(n){return e(n,s(!0))}function v(n,t){try{return n.run(t)}catch(n){return s(!1)}}module.exports=function(){function t(t){return i.run({value:t},(function(){return l(n(r,(function(n,r){(n=v(n,t)).pass||r(n)})))}))}for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return Object.assign((function(n){if(!(n=t(n)).pass){if(!a(n.message))throw n.message;u()}}),{run:t,test:function(n){return t(n).pass}})};
|
|
@@ -18,7 +18,7 @@ var promisify = function (validatorFn) {
|
|
|
18
18
|
args[_i] = arguments[_i];
|
|
19
19
|
}
|
|
20
20
|
if (!isFunction(validatorFn)) {
|
|
21
|
-
throwError('
|
|
21
|
+
throwError('promisify: Expected validatorFn to be a function.');
|
|
22
22
|
}
|
|
23
23
|
return new Promise(function (resolve) { return validatorFn.apply(void 0, args).done(resolve); });
|
|
24
24
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function n(n){return"function"==typeof n}function r(r,t){var o;return null!==(o=function(r){for(var t=[],o=1;o<arguments.length;o++)t[o-1]=arguments[o];return n(r)?r.apply(void 0,t):r}(r))&&void 0!==o?o:t}function t(n,t){throw Error(r(t,n))}module.exports=function(r){return function(){for(var o=[],e=0;e<arguments.length;e++)o[e]=arguments[e];return n(r)||t("
|
|
1
|
+
"use strict";function n(n){return"function"==typeof n}function r(r,t){var o;return null!==(o=function(r){for(var t=[],o=1;o<arguments.length;o++)t[o-1]=arguments[o];return n(r)?r.apply(void 0,t):r}(r))&&void 0!==o?o:t}function t(n,t){throw Error(r(t,n))}module.exports=function(r){return function(){for(var o=[],e=0;e<arguments.length;e++)o[e]=arguments[e];return n(r)||t("promisify: Expected validatorFn to be a function."),new Promise((function(n){return r.apply(void 0,o).done(n)}))}};
|