vest 4.0.0-dev-7acb76 → 4.0.0-next-03ba92

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 (54) hide show
  1. package/CHANGELOG.md +62 -50
  2. package/README.md +12 -0
  3. package/dist/cjs/classnames.development.js +3 -3
  4. package/dist/cjs/classnames.production.js +1 -1
  5. package/dist/cjs/compose.js +7 -0
  6. package/dist/cjs/enforce/compose.development.js +222 -0
  7. package/dist/cjs/enforce/compose.production.js +1 -0
  8. package/dist/cjs/enforce/package.json +1 -0
  9. package/dist/cjs/promisify.development.js +1 -1
  10. package/dist/cjs/promisify.production.js +1 -1
  11. package/dist/cjs/vest.development.js +216 -153
  12. package/dist/cjs/vest.production.js +1 -1
  13. package/dist/es/classnames.development.js +3 -3
  14. package/dist/es/classnames.production.js +1 -1
  15. package/dist/es/enforce/compose.development.js +220 -0
  16. package/dist/es/enforce/compose.production.js +1 -0
  17. package/dist/es/enforce/package.json +1 -0
  18. package/dist/es/promisify.development.js +1 -1
  19. package/dist/es/promisify.production.js +1 -1
  20. package/dist/es/vest.development.js +216 -153
  21. package/dist/es/vest.production.js +1 -1
  22. package/dist/umd/classnames.development.js +3 -3
  23. package/dist/umd/classnames.production.js +1 -1
  24. package/dist/umd/enforce/compose.development.js +228 -0
  25. package/dist/umd/enforce/compose.production.js +1 -0
  26. package/dist/umd/promisify.development.js +1 -1
  27. package/dist/umd/promisify.production.js +1 -1
  28. package/dist/umd/vest.development.js +216 -153
  29. package/dist/umd/vest.production.js +1 -1
  30. package/enforce/compose/package.json +7 -0
  31. package/package.json +32 -1
  32. package/types/classnames.d.ts +2 -2
  33. package/types/enforce/compose.d.ts +9 -0
  34. package/types/vest.d.ts +28 -12
  35. package/docs/.nojekyll +0 -0
  36. package/docs/README.md +0 -113
  37. package/docs/_assets/favicon.ico +0 -0
  38. package/docs/_assets/vest-logo.png +0 -0
  39. package/docs/_sidebar.md +0 -14
  40. package/docs/cross_field_validations.md +0 -33
  41. package/docs/enforce.md +0 -11
  42. package/docs/exclusion.md +0 -129
  43. package/docs/getting_started.md +0 -72
  44. package/docs/group.md +0 -142
  45. package/docs/index.html +0 -41
  46. package/docs/migration.md +0 -202
  47. package/docs/n4s/rules.md +0 -1282
  48. package/docs/node.md +0 -36
  49. package/docs/optional.md +0 -103
  50. package/docs/result.md +0 -249
  51. package/docs/state.md +0 -102
  52. package/docs/test.md +0 -172
  53. package/docs/utilities.md +0 -109
  54. package/docs/warn.md +0 -82
package/CHANGELOG.md CHANGED
@@ -4,73 +4,85 @@ 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-25
7
+ ## 4.0.0 - 2021-11-20
8
8
  ### Changed or removed
9
- - f5ba507 major(context): used named export in context (ealush)
10
- - eaed68f breaking(vest, enforce): prepare next major (ealush)
9
+ - 7c43eab major(context): used named export in context (ealush)
10
+ - e8652bc breaking(vest, enforce): prepare next major (ealush)
11
+ - dab8e00 breaking(vest, enforce): prepare next major (ealush)
11
12
 
12
13
  ### Added
13
- - e0f0f91 feat(vest): support custom optional logic (ealush)
14
- - d4fecee feat(vest): Add a parser export (ealush)
15
- - e72498d feat(vest): isValid with field name (ealush)
16
- - f60d952 feat(vest): handle execution order state refill with memoized tests (ealush)
17
- - a2b60c4 feat(vest): Make the state rely on execution order. Make skipWhen set skipped context. (undefined)
18
- - ae5eb02 added(n4s): partial rule modifier (undefined)
19
- - 990c68f feat(n4s): context propagation within enforce (undefined)
14
+ - d3e7613 feat(vest): support custom optional logic (ealush)
15
+ - be1cbf6 feat(vest): Add a parser export (ealush)
16
+ - 2553748 feat(vest): isValid with field name (ealush)
17
+ - ec5ceb9 feat(vest): handle execution order state refill with memoized tests (ealush)
18
+ - 4032bd8 feat(vest): Make the state rely on execution order. Make skipWhen set skipped context. (undefined)
19
+ - 220127b added(n4s): partial rule modifier (undefined)
20
+ - b5ce72d feat(n4s): context propagation within enforce (undefined)
20
21
 
21
22
  ### Fixed and improved
22
- - 7acb76f fix(vest): prevent pending tests from being marked as skipped (ealush)
23
- - 8851ff5 patch(vest): Add isolate module for containing re-orders (ealush)
24
- - 0593c0f patch(vest): refresh tests after cancel (ealush)
25
- - e915b53 patch: add cursor util (ealush)
26
- - f54ae8b patch(vest): move cursor into context (ealush)
27
- - fc7627e patch(vest): automatically purge not-found test results (ealush)
28
- - d68d990 vx: correctly pass cli options to build script (ealush)
29
- - 7c47b9a patch(vest): Throw error when tests are called in the wrong order (ealush)
30
- - 01be84e vx: add types to exports (ealush)
31
- - 7201170 organize vest state hooks (ealush)
32
- - e39bfd8 patch(vest): infer omitted optional fields (ealush)
33
- - 93014e3 vx: add dev bundle to exports (ealush)
34
- - 91df42e fix(vest): prevent changing test status once it was finalized (ealush)
35
- - 797df3e patch(vest): add cache invalidation for canceled tests (ealush)
36
- - 14ba6d9 types(vest): add safeguard around shouldUseErrorAsMessage (ealush)
37
- - 477ca00 patch(vest): some cleanups (ealush)
38
- - 58d5ed3 patch(vest): remove duplicate code handling perv test registration (ealush)
39
- - 6a98443 vx: use context directly from published package (ealush)
40
- - a79e479 patch: run done callbacks via event (ealush)
41
- - 01d32b7 patch(vest): removed state subscription (ealush)
23
+ - 03ba92c vx: support namespaced exports (ealush)
24
+ - 38a54ae vx: support installing of local packages (ealush)
25
+ - 7baedf2 n4s: use named export in entry (ealush)
26
+ - 366001b patch(vest): better handling of skipped async tests (ealush)
27
+ - 2380679 types(vest): allow unprovided suite name in tests (ealush)
28
+ - f721b2d patch(vest): replace warns boolean flag with enum (ealush)
29
+ - 0acb24d patch(vest): Pass draft result to skipWhen conditional (ealush)
30
+ - e84cd9d patch(vest): add back optional suite name argument (ealush)
31
+ - 8b30b66 patch(vest): make compose an external export (ealush)
32
+ - ddfa9fd patch(vest): move creation functions to event bus (ealush)
33
+ - fe83e88 patch: Some cleanups (ealush)
34
+ - 9275707 fix(vest): prevent pending tests from being marked as skipped (ealush)
35
+ - 94e00a8 patch(vest): Add isolate module for containing re-orders (ealush)
36
+ - 5bcc14a patch(vest): refresh tests after cancel (ealush)
37
+ - fd049e8 patch: add cursor util (ealush)
38
+ - 9380c09 patch(vest): move cursor into context (ealush)
39
+ - 49b72f4 patch(vest): automatically purge not-found test results (ealush)
40
+ - 2dfedaf vx: correctly pass cli options to build script (ealush)
41
+ - aae250a patch(vest): Throw error when tests are called in the wrong order (ealush)
42
+ - a87824b vx: add types to exports (ealush)
43
+ - cc9b4b0 organize vest state hooks (ealush)
44
+ - df84261 patch(vest): infer omitted optional fields (ealush)
45
+ - 2534cf6 vx: add dev bundle to exports (ealush)
46
+ - 4d450aa fix(vest): prevent changing test status once it was finalized (ealush)
47
+ - 8730e25 patch(vest): add cache invalidation for canceled tests (ealush)
48
+ - 4cb2c6c types(vest): add safeguard around shouldUseErrorAsMessage (ealush)
49
+ - c214a12 patch(vest): some cleanups (ealush)
50
+ - 858458d patch(vest): remove duplicate code handling perv test registration (ealush)
51
+ - ec69173 vx: use context directly from published package (ealush)
52
+ - 962bc06 patch: run done callbacks via event (ealush)
53
+ - d96f428 patch(vest): removed state subscription (ealush)
42
54
  - package.json
43
55
  - packages/anyone/package.json
44
56
  - packages/anyone/package.json
45
57
  - packages/vast/types/vast.d.ts
46
- - b10b98b patch(vest): remove pending and lagging state (ealush)
47
- - dfd2cc3 patch(vest): convert boolean flags to a single status key (ealush)
48
- - 1c9da6c patch: simplify fieldname comparison (ealush)
49
- - 43c75a4 patch(vest): add useAllIncomplete hook (ealush)
50
- - 2dfdc97 patch(vest): invalid accounts for warning tests as well (ealush)
51
- - 4033cca patch(vest): isValid counts all required tests per field (ealush)
52
- - 02b28a6 chore: cleanups (ealush)
58
+ - e4e1746 patch(vest): remove pending and lagging state (ealush)
59
+ - 9d8fd21 patch(vest): convert boolean flags to a single status key (ealush)
60
+ - dbb836e patch: simplify fieldname comparison (ealush)
61
+ - 5a78179 patch(vest): add useAllIncomplete hook (ealush)
62
+ - b5ae658 patch(vest): invalid accounts for warning tests as well (ealush)
63
+ - 4563b8d patch(vest): isValid counts all required tests per field (ealush)
64
+ - 3fe2f21 chore: cleanups (ealush)
53
65
  - .eslintrc.js
54
- - afa16e9 add(n4s): enforce.condition (ealush)
66
+ - 149aab3 add(n4s): enforce.condition (ealush)
55
67
  - package.json
56
68
  - packages/anyone/package.json
57
- - d452e26 chore: cleanup residue (undefined)
58
- - 5982183 chore: remove duplicate types (undefined)
69
+ - 40ef071 chore: cleanup residue (undefined)
70
+ - eeac20e chore: remove duplicate types (undefined)
59
71
  - packages/anyone/package.json
60
- - 52ac8e0 patch: add nodejs exports (undefined)
61
- - f9c4b3e patch: remove unused exports (undefined)
72
+ - 4d88c04 patch: add nodejs exports (undefined)
73
+ - 6e57aa1 patch: remove unused exports (undefined)
62
74
  - packages/anyone/package.json
63
- - db0253b chore: reduce complexity, remove all lint errors (undefined)
75
+ - 26af06b chore: reduce complexity, remove all lint errors (undefined)
64
76
  - packages/anyone/.npmignore
65
77
  - .github/PULL_REQUEST_TEMPLATE.md
66
- - be9c776 chore: cleanup unused code (ealush)
67
- - c5eb2de lint: handling lint of all packages (ealush)
78
+ - 5be986d chore: cleanup unused code (ealush)
79
+ - ba68539 lint: handling lint of all packages (ealush)
68
80
  - .gitignore
69
- - d388fdc patch(n4s): add ruleReturn default values (ealush)
70
- - be91b7e fix(n4s): make enforce compound runners fall back to correct response (ealush)
71
- - 7e8f25c fix(n4s): make enforce chaining work (ealush)
72
- - e60ce3b chore: some lint fixes (ealush)
73
- - fc8e2d8 add cli options support (ealush)
81
+ - cca5130 patch(n4s): add ruleReturn default values (ealush)
82
+ - 75306ff fix(n4s): make enforce compound runners fall back to correct response (ealush)
83
+ - 4751584 fix(n4s): make enforce chaining work (ealush)
84
+ - 73b28a1 chore: some lint fixes (ealush)
85
+ - 4135ce3 add cli options support (ealush)
74
86
 
75
87
  ## 3.2.7 - 2021-07-17
76
88
 
package/README.md CHANGED
@@ -1,5 +1,17 @@
1
1
  ![Vest](https://cdn.jsdelivr.net/gh/ealush/vest@assets/vest-logo.png 'Vest')
2
2
 
3
+ # Version 4 of Vest is coming soon!
4
+
5
+ If you want to try it out, you can already install it with the `next` tag.
6
+
7
+ ```npm install vest@next```
8
+
9
+ This version brings many enhancements to Vest. This version is well tested, and can be used safely. If you do, however encounter any issues or have any thoughts on the next version, please report them on the issues page.
10
+
11
+ For the version 4 docs, you can reach out to: https://vest.vercel.app/ or specifically to the [migration guide](https://vest.vercel.app/docs/migration_guide).
12
+
13
+ A note on Typescript support: Version four uses Typescript 4 specific features, so for now only version 4 is supported.
14
+
3
15
  # Vest 🦺 Declarative Validation Testing
4
16
 
5
17
  ![Github Stars](https://githubbadges.com/star.svg?user=ealush&repo=vest&style=flat)
@@ -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 classNames(res, classes) {
59
+ function classnames(res, classes) {
60
60
  if (classes === void 0) { classes = {}; }
61
61
  if (!res || !isFunction(res.hasErrors)) {
62
- throwError("[vest/classNames]: Expected first argument to be Vest's result object.");
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 = classNames;
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))}("[vest/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(" ")}};
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,7 @@
1
+ 'use strict'
2
+
3
+ if (process.env.NODE_ENV === 'production') {
4
+ module.exports = require('./compose.production.js');
5
+ } else {
6
+ module.exports = require('./compose.development.js');
7
+ }
@@ -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. Feel free to help.
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}})};
@@ -0,0 +1 @@
1
+ {"type":"commonjs"}
@@ -18,7 +18,7 @@ var promisify = function (validatorFn) {
18
18
  args[_i] = arguments[_i];
19
19
  }
20
20
  if (!isFunction(validatorFn)) {
21
- throwError('[vest/promisify]: Expected validatorFn to be a function.');
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("[vest/promisify]: Expected validatorFn to be a function."),new Promise((function(n){return r.apply(void 0,o).done(n)}))}};
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)}))}};