n4s 3.1.0 → 4.0.0-dev-e266d9

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 (63) hide show
  1. package/CHANGELOG.md +129 -0
  2. package/LICENSE +1 -2
  3. package/README.md +2 -5
  4. package/compose/package.json +7 -0
  5. package/compounds/package.json +7 -0
  6. package/dist/cjs/compose.development.js +139 -0
  7. package/dist/cjs/compose.js +7 -0
  8. package/dist/cjs/compose.production.js +1 -0
  9. package/dist/cjs/compounds.development.js +132 -0
  10. package/dist/cjs/compounds.js +7 -0
  11. package/dist/cjs/compounds.production.js +1 -0
  12. package/dist/cjs/n4s.development.js +602 -0
  13. package/dist/cjs/n4s.js +7 -0
  14. package/dist/cjs/n4s.production.js +1 -0
  15. package/dist/cjs/package.json +1 -0
  16. package/dist/cjs/schema.development.js +144 -0
  17. package/dist/cjs/schema.js +7 -0
  18. package/dist/cjs/schema.production.js +1 -0
  19. package/dist/es/compose.development.js +137 -0
  20. package/dist/es/compose.production.js +1 -0
  21. package/dist/es/compounds.development.js +130 -0
  22. package/dist/es/compounds.production.js +1 -0
  23. package/dist/es/n4s.development.js +597 -0
  24. package/dist/es/n4s.production.js +1 -0
  25. package/dist/es/package.json +1 -0
  26. package/dist/es/schema.development.js +140 -0
  27. package/dist/es/schema.production.js +1 -0
  28. package/dist/umd/compose.development.js +143 -0
  29. package/dist/umd/compose.production.js +1 -0
  30. package/dist/umd/compounds.development.js +136 -0
  31. package/dist/umd/compounds.production.js +1 -0
  32. package/dist/umd/n4s.development.js +606 -0
  33. package/dist/umd/n4s.production.js +1 -0
  34. package/dist/umd/schema.development.js +148 -0
  35. package/dist/umd/schema.production.js +1 -0
  36. package/docs/README.md +2 -5
  37. package/docs/_sidebar.md +0 -1
  38. package/docs/external.md +1 -28
  39. package/package.json +129 -53
  40. package/schema/package.json +7 -0
  41. package/tsconfig.json +8 -0
  42. package/types/compose.d.ts +134 -0
  43. package/types/compounds.d.ts +146 -0
  44. package/types/n4s.d.ts +167 -0
  45. package/types/schema.d.ts +151 -0
  46. package/config/jest/jest.setup.js +0 -14
  47. package/config/rollup/enforce.js +0 -8
  48. package/config/rollup/rollup.config.js +0 -3
  49. package/docs/compound.md +0 -187
  50. package/docs/custom.md +0 -52
  51. package/docs/template.md +0 -53
  52. package/esm/n4s.es.development.js +0 -1142
  53. package/esm/n4s.es.production.js +0 -1142
  54. package/esm/n4s.es.production.min.js +0 -1
  55. package/esm/package.json +0 -1
  56. package/jest.config.js +0 -3
  57. package/n4s.cjs.development.js +0 -1144
  58. package/n4s.cjs.production.js +0 -1144
  59. package/n4s.cjs.production.min.js +0 -1
  60. package/n4s.js +0 -7
  61. package/n4s.umd.development.js +0 -1231
  62. package/n4s.umd.production.js +0 -1231
  63. package/n4s.umd.production.min.js +0 -1
package/CHANGELOG.md ADDED
@@ -0,0 +1,129 @@
1
+ # n4s - Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
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
+
7
+ ## 4.0.0 - 2021-12-12
8
+ ### Changed or removed
9
+ - b5a0108 breaking(vest): remove test.each (ealush)
10
+ - 7c43eab major(context): used named export in context (ealush)
11
+ - e8652bc breaking(vest, enforce): prepare next major (ealush)
12
+ - dab8e00 breaking(vest, enforce): prepare next major (ealush)
13
+
14
+ ### Added
15
+ - b0a9a14 feat(vest): use key prop to retain test state after reorder (#732) (Evyatar)
16
+ - 49e601a feat(n4s): enforce.compose (ealush)
17
+ - 2b902cb added(n4s): add custom message support to lazy enforcements (undefined)
18
+ - 220127b added(n4s): partial rule modifier (undefined)
19
+ - b5ce72d feat(n4s): context propagation within enforce (undefined)
20
+ - 651de44 feat(n4s): optional (undefined)
21
+ - 516ff54 feat(n4s): isArrayOf (undefined)
22
+ - 32fe8a5 feat(n4s): add shape and loose validations (undefined)
23
+
24
+ ### Fixed and improved
25
+ - 1384c08 fix(vest): only.group works in conjunction with only (#734) (Evyatar)
26
+ - 7daf6d2 rule(n4s): add isNullish rule, improve isBlank (ealush)
27
+ - 825e74b types(n4s): fix proxy type (ealush)
28
+ - ddceca7 patch(n4s): improve partial support (ealush)
29
+ - d0421dc chore(n4s): add plugins directory (ealush)
30
+ - 9f9b970 vx: improve package.json generation (ealush)
31
+ - 0370fc1 n4s: extract non-required modules (ealush)
32
+ - 03ba92c vx: support namespaced exports (ealush)
33
+ - 38a54ae vx: support installing of local packages (ealush)
34
+ - 7baedf2 n4s: use named export in entry (ealush)
35
+ - 366001b patch(vest): better handling of skipped async tests (ealush)
36
+ - 5e9194f vx: add next release process (ealush)
37
+ - 7473483 hack(n4s): use 'any' as the input for compose (ealush)
38
+ - 8b30b66 patch(vest): make compose an external export (ealush)
39
+ - fe83e88 patch: Some cleanups (ealush)
40
+ - 780c5b7 types(n4s): Allow adding types for custom matchers (ealush)
41
+ - 94e00a8 patch(vest): Add isolate module for containing re-orders (ealush)
42
+ - bed7040 vx: add back to workspace (ealush)
43
+ - aae250a patch(vest): Throw error when tests are called in the wrong order (ealush)
44
+ - f2d458d update build artifacts (ealush)
45
+ - dc99d94 patch: shorten isBlank (ealush)
46
+ - package.json
47
+ - packages/anyone/package.json
48
+ - dbb836e patch: simplify fieldname comparison (ealush)
49
+ - 3fe2f21 chore: cleanups (ealush)
50
+ - .eslintrc.js
51
+ - 149aab3 add(n4s): enforce.condition (ealush)
52
+ - packages/anyone/README.md
53
+ - package.json
54
+ - d786b34 fix(n4s): make sure oneOf correctly validates single case (ealush)
55
+ - 13830b9 types(n4s): simplify the types for (ealush)
56
+ - packages/anyone/package.json
57
+ - 40ef071 chore: cleanup residue (undefined)
58
+ - eeac20e chore: remove duplicate types (undefined)
59
+ - e4e2a80 tests(n4s): add paritla tests (undefined)
60
+ - packages/anyone/package.json
61
+ - 4d88c04 patch: add nodejs exports (undefined)
62
+ - 6e57aa1 patch: remove unused exports (undefined)
63
+ - 1dddaf4 patch(n4s): improve types for rule chaining (undefined)
64
+ - packages/anyone/package.json
65
+ - 97175f1 patch: simplify proxy test/run assignment (undefined)
66
+ - 39b92f1 patch: enable enforce in es5 environments (undefined)
67
+ - 26af06b chore: reduce complexity, remove all lint errors (undefined)
68
+ - packages/anyone/.npmignore
69
+ - .github/PULL_REQUEST_TEMPLATE.md
70
+ - 5be986d chore: cleanup unused code (ealush)
71
+ - ba68539 lint: handling lint of all packages (ealush)
72
+ - .gitignore
73
+ - cca5130 patch(n4s): add ruleReturn default values (ealush)
74
+ - 75306ff fix(n4s): make enforce compound runners fall back to correct response (ealush)
75
+ - 4751584 fix(n4s): make enforce chaining work (ealush)
76
+ - 73b28a1 chore: some lint fixes (ealush)
77
+
78
+ ## 3.1.0 - 2021-08-06
79
+
80
+ ### Added
81
+
82
+ - bf432a1 added(n4s): add custom message support to lazy enforcements (undefined)
83
+ - c093a7f added(n4s): partial rule modifier (undefined)
84
+ - 045bc72 feat(n4s): context propagation within enforce (undefined)
85
+ - 443df9d feat(n4s): optional (undefined)
86
+ - 86172ca feat(n4s): isArrayOf (undefined)
87
+ - f48f38b feat(n4s): add shape and loose validations (undefined)
88
+
89
+ ### Fixed and improved
90
+
91
+ - fdcf20b genscript (undefined)
92
+ - b12614f chore: cleanup residue (undefined)
93
+ - 4da20b4 chore: remove duplicate types (undefined)
94
+ - c66298d tests(n4s): add paritla tests (undefined)
95
+ - packages/anyone/package.json
96
+ - a8c1e67 patch: add nodejs exports (undefined)
97
+ - 83efb86 patch: remove unused exports (undefined)
98
+ - 9546b9e patch(n4s): improve types for rule chaining (undefined)
99
+ - packages/anyone/package.json
100
+ - 7bab926 patch: simplify proxy test/run assignment (undefined)
101
+ - ed5c903 patch: enable enforce in es5 environments (undefined)
102
+ - 3494de6 chore: reduce complexity, remove all lint errors (undefined)
103
+ - packages/anyone/.npmignore
104
+ - .github/PULL_REQUEST_TEMPLATE.md
105
+ - aec6cd6 chore: cleanup unused code (ealush)
106
+ - 0103b38 lint: handling lint of all packages (ealush)
107
+ - .gitignore
108
+ - 03cf487 patch(n4s): add ruleReturn default values (ealush)
109
+ - 76e8c98 fix(n4s): make enforce compound runners fall back to correct response (ealush)
110
+ - ff91bd2 fix(n4s): make enforce chaining work (ealush)
111
+ - c3fd912 chore: some lint fixes (ealush)
112
+ - 49b6b84 Vest 4 Infra Setup (ealush)
113
+
114
+ ## 1.1.14 - 2021-07-02
115
+
116
+ ### Fixed and improved
117
+
118
+ - 34e0414 improved conditions (undefined)
119
+ - 26c28c6 all tests pass (undefined)
120
+ - 33f4e46 release (undefined)
121
+ - 6fe40c7 better bundle (undefined)
122
+ - c2cfb65 better typing (undefined)
123
+ - c6387ab before ts settings (undefined)
124
+ - c0e9708 generate correct d.ts file (undefined)
125
+ - 8e01b8e x (undefined)
126
+ - afb3960 x (undefined)
127
+ - e0a8463 add changelog support (undefined)
128
+ - cc46c38 current (undefined)
129
+ - b6db1c6 transform any to unknowns (ealush)
package/LICENSE CHANGED
@@ -1,7 +1,6 @@
1
1
  MIT License
2
2
 
3
3
  Copyright (c) 2020 ealush
4
- Copyright (c) 2019 Fiverr
5
4
 
6
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
7
6
  of this software and associated documentation files (the "Software"), to deal
@@ -19,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
18
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
- SOFTWARE.
21
+ SOFTWARE.
package/README.md CHANGED
@@ -7,7 +7,7 @@ By default, enforce throws an error when your validations fail. These errors sho
7
7
  You can extend Enforce per need, and you can add your custom validation rules in your app.
8
8
 
9
9
  ```js
10
- import enforce from 'n4s';
10
+ import { enforce } from 'n4s';
11
11
 
12
12
  enforce(4).isNumber();
13
13
  // passes
@@ -33,10 +33,7 @@ npm i n4s
33
33
  If you wish to use enforce's functionality safely with a boolean return interface, you can use its lazy validation interface:
34
34
 
35
35
  ```js
36
- enforce
37
- .isArray()
38
- .longerThan(3)
39
- .test([1,2,3])
36
+ enforce.isArray().longerThan(3).test([1, 2, 3]);
40
37
  ```
41
38
 
42
39
  [Read the docs](https://ealush.github.io/n4s)
@@ -0,0 +1,7 @@
1
+ {
2
+ "main": "../dist/cjs/compose.js",
3
+ "module": "../dist/es/compose.production.js",
4
+ "name": "compose",
5
+ "types": "../types/compose.d.ts",
6
+ "private": true
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "main": "../dist/cjs/compounds.js",
3
+ "module": "../dist/es/compounds.production.js",
4
+ "name": "compounds",
5
+ "types": "../types/compounds.d.ts",
6
+ "private": true
7
+ }
@@ -0,0 +1,139 @@
1
+ 'use strict';
2
+
3
+ var n4s = require('n4s');
4
+
5
+ function mapFirst(array, callback) {
6
+ var broke = false;
7
+ var breakoutValue = null;
8
+ for (var i = 0; i < array.length; i++) {
9
+ callback(array[i], breakout, i);
10
+ if (broke) {
11
+ return breakoutValue;
12
+ }
13
+ }
14
+ function breakout(value) {
15
+ broke = true;
16
+ breakoutValue = value;
17
+ }
18
+ }
19
+
20
+ function isFunction(value) {
21
+ return typeof value === 'function';
22
+ }
23
+
24
+ function optionalFunctionValue(value) {
25
+ var args = [];
26
+ for (var _i = 1; _i < arguments.length; _i++) {
27
+ args[_i - 1] = arguments[_i];
28
+ }
29
+ return isFunction(value) ? value.apply(void 0, args) : value;
30
+ }
31
+
32
+ function defaultTo(callback, defaultValue) {
33
+ var _a;
34
+ return (_a = optionalFunctionValue(callback)) !== null && _a !== void 0 ? _a : defaultValue;
35
+ }
36
+
37
+ /**
38
+ * Throws a timed out error.
39
+ */
40
+ function throwError(devMessage, productionMessage) {
41
+ throw new Error(devMessage );
42
+ }
43
+
44
+ /**
45
+ * A safe hasOwnProperty access
46
+ */
47
+ function hasOwnProperty(obj, key) {
48
+ return Object.prototype.hasOwnProperty.call(obj, key);
49
+ }
50
+
51
+ function isNumber(value) {
52
+ return Boolean(typeof value === 'number');
53
+ }
54
+
55
+ function lengthEquals(value, arg1) {
56
+ return value.length === Number(arg1);
57
+ }
58
+
59
+ function isEmpty(value) {
60
+ if (!value) {
61
+ return true;
62
+ }
63
+ else if (isNumber(value)) {
64
+ return value === 0;
65
+ }
66
+ else if (hasOwnProperty(value, 'length')) {
67
+ return lengthEquals(value, 0);
68
+ }
69
+ else if (typeof value === 'object') {
70
+ return lengthEquals(Object.keys(value), 0);
71
+ }
72
+ return true;
73
+ }
74
+
75
+ function ruleReturn(pass, message) {
76
+ var output = { pass: pass };
77
+ if (message) {
78
+ output.message = message;
79
+ }
80
+ return output;
81
+ }
82
+ function failing() {
83
+ return ruleReturn(false);
84
+ }
85
+ function passing() {
86
+ return ruleReturn(true);
87
+ }
88
+ function defaultToPassing(callback) {
89
+ return defaultTo(callback, passing());
90
+ }
91
+
92
+ function runLazyRule(lazyRule, currentValue) {
93
+ try {
94
+ return lazyRule.run(currentValue);
95
+ }
96
+ catch (_a) {
97
+ return failing();
98
+ }
99
+ }
100
+
101
+ /* eslint-disable max-lines-per-function */
102
+ function compose() {
103
+ var composites = [];
104
+ for (var _i = 0; _i < arguments.length; _i++) {
105
+ composites[_i] = arguments[_i];
106
+ }
107
+ return Object.assign(function (value) {
108
+ var res = run(value);
109
+ if (!res.pass) {
110
+ if (isEmpty(res.message)) {
111
+ throwError();
112
+ }
113
+ else {
114
+ // Explicitly throw a string so that vest.test can pick it up as the validation error message
115
+ throw res.message;
116
+ }
117
+ }
118
+ }, {
119
+ run: run,
120
+ test: function (value) { return run(value).pass; }
121
+ });
122
+ function run(value) {
123
+ return n4s.ctx.run({ value: value }, function () {
124
+ return defaultToPassing(mapFirst(composites, function (composite, breakout) {
125
+ /* HACK: Just a small white lie. ~~HELP WANTED~~.
126
+ The ideal is that instead of `TLazyRuleRunners` We would simply use `TLazy` to begin with.
127
+ The problem is that lazy rules can't really be passed to this function due to some generic hell
128
+ so we're limiting it to a small set of functions.
129
+ */
130
+ var res = runLazyRule(composite, value);
131
+ if (!res.pass) {
132
+ breakout(res);
133
+ }
134
+ }));
135
+ });
136
+ }
137
+ }
138
+
139
+ module.exports = compose;
@@ -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 @@
1
+ "use strict";var n=require("n4s");function r(n,r){function t(n){u=!0,e=n}for(var u=!1,e=null,o=0;o<n.length;o++)if(r(n[o],t,o),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){throw Error(u(r,n))}function o(n,r){return n.length===Number(r)}function f(n){if(n){if(function(n){return"number"==typeof n}(n))return 0===n;if(function(n,r){return Object.prototype.hasOwnProperty.call(n,r)}(n,"length"))return o(n,0);if("object"==typeof n)return o(Object.keys(n),0)}return!0}function i(n,r){return n={pass:n},r&&(n.message=r),n}function c(n){return u(n,i(!0))}function s(n,r){try{return n.run(r)}catch(n){return i(!1)}}module.exports=function(){function t(t){return n.ctx.run({value:t},(function(){return c(r(u,(function(n,r){(n=s(n,t)).pass||r(n)})))}))}for(var u=[],o=0;o<arguments.length;o++)u[o]=arguments[o];return Object.assign((function(n){if(!(n=t(n)).pass){if(!f(n.message))throw n.message;e()}}),{run:t,test:function(n){return t(n).pass}})};
@@ -0,0 +1,132 @@
1
+ 'use strict';
2
+
3
+ var n4s = require('n4s');
4
+
5
+ function mapFirst(array, callback) {
6
+ var broke = false;
7
+ var breakoutValue = null;
8
+ for (var i = 0; i < array.length; i++) {
9
+ callback(array[i], breakout, i);
10
+ if (broke) {
11
+ return breakoutValue;
12
+ }
13
+ }
14
+ function breakout(value) {
15
+ broke = true;
16
+ breakoutValue = value;
17
+ }
18
+ }
19
+
20
+ function isFunction(value) {
21
+ return typeof value === 'function';
22
+ }
23
+
24
+ function optionalFunctionValue(value) {
25
+ var args = [];
26
+ for (var _i = 1; _i < arguments.length; _i++) {
27
+ args[_i - 1] = arguments[_i];
28
+ }
29
+ return isFunction(value) ? value.apply(void 0, args) : value;
30
+ }
31
+
32
+ function defaultTo(callback, defaultValue) {
33
+ var _a;
34
+ return (_a = optionalFunctionValue(callback)) !== null && _a !== void 0 ? _a : defaultValue;
35
+ }
36
+
37
+ function ruleReturn(pass, message) {
38
+ var output = { pass: pass };
39
+ if (message) {
40
+ output.message = message;
41
+ }
42
+ return output;
43
+ }
44
+ function failing() {
45
+ return ruleReturn(false);
46
+ }
47
+ function passing() {
48
+ return ruleReturn(true);
49
+ }
50
+ function defaultToFailing(callback) {
51
+ return defaultTo(callback, failing());
52
+ }
53
+ function defaultToPassing(callback) {
54
+ return defaultTo(callback, passing());
55
+ }
56
+
57
+ function runLazyRule(lazyRule, currentValue) {
58
+ try {
59
+ return lazyRule.run(currentValue);
60
+ }
61
+ catch (_a) {
62
+ return failing();
63
+ }
64
+ }
65
+
66
+ function allOf(value) {
67
+ var rules = [];
68
+ for (var _i = 1; _i < arguments.length; _i++) {
69
+ rules[_i - 1] = arguments[_i];
70
+ }
71
+ return defaultToPassing(mapFirst(rules, function (rule, breakout) {
72
+ var res = runLazyRule(rule, value);
73
+ if (!res.pass) {
74
+ breakout(res);
75
+ }
76
+ }));
77
+ }
78
+
79
+ function anyOf(value) {
80
+ var rules = [];
81
+ for (var _i = 1; _i < arguments.length; _i++) {
82
+ rules[_i - 1] = arguments[_i];
83
+ }
84
+ return defaultToFailing(mapFirst(rules, function (rule, breakout) {
85
+ var res = runLazyRule(rule, value);
86
+ if (res.pass) {
87
+ breakout(res);
88
+ }
89
+ }));
90
+ }
91
+
92
+ function noneOf(value) {
93
+ var rules = [];
94
+ for (var _i = 1; _i < arguments.length; _i++) {
95
+ rules[_i - 1] = arguments[_i];
96
+ }
97
+ return defaultToPassing(mapFirst(rules, function (rule, breakout) {
98
+ var res = runLazyRule(rule, value);
99
+ if (res.pass) {
100
+ breakout(failing());
101
+ }
102
+ }));
103
+ }
104
+
105
+ function lengthEquals(value, arg1) {
106
+ return value.length === Number(arg1);
107
+ }
108
+
109
+ function longerThan(value, arg1) {
110
+ return value.length > Number(arg1);
111
+ }
112
+
113
+ var REQUIRED_COUNT = 1;
114
+ function oneOf(value) {
115
+ var rules = [];
116
+ for (var _i = 1; _i < arguments.length; _i++) {
117
+ rules[_i - 1] = arguments[_i];
118
+ }
119
+ var passing = [];
120
+ rules.some(function (rule) {
121
+ if (longerThan(passing, REQUIRED_COUNT)) {
122
+ return false;
123
+ }
124
+ var res = runLazyRule(rule, value);
125
+ if (res.pass) {
126
+ passing.push(res);
127
+ }
128
+ });
129
+ return ruleReturn(lengthEquals(passing, REQUIRED_COUNT));
130
+ }
131
+
132
+ n4s.enforce.extend({ allOf: allOf, anyOf: anyOf, noneOf: noneOf, oneOf: oneOf });
@@ -0,0 +1,7 @@
1
+ 'use strict'
2
+
3
+ if (process.env.NODE_ENV === 'production') {
4
+ module.exports = require('./compounds.production.js');
5
+ } else {
6
+ module.exports = require('./compounds.development.js');
7
+ }
@@ -0,0 +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,r){return n.length===Number(r)}function s(n,r){return n.length>Number(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(s(u,1))return!1;(r=c(r,n)).pass&&u.push(r)})),e(a(u,1))}});