n4s 4.1.7 → 4.1.8-dev-ae93bf
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/compose.development.js +6 -53
- package/dist/cjs/compose.production.js +1 -1
- package/dist/cjs/compounds.development.js +16 -71
- package/dist/cjs/compounds.production.js +1 -1
- package/dist/cjs/n4s.development.js +74 -218
- package/dist/cjs/n4s.production.js +1 -1
- package/dist/cjs/schema.development.js +6 -58
- package/dist/cjs/schema.production.js +1 -1
- package/dist/es/compose.development.js +4 -51
- package/dist/es/compose.production.js +1 -1
- package/dist/es/compounds.development.js +11 -66
- package/dist/es/compounds.production.js +1 -1
- package/dist/es/n4s.development.js +16 -160
- package/dist/es/n4s.production.js +1 -1
- package/dist/es/schema.development.js +2 -54
- package/dist/es/schema.production.js +1 -1
- package/dist/umd/compose.development.js +19 -13
- package/dist/umd/compose.production.js +1 -1
- package/dist/umd/compounds.development.js +37 -49
- package/dist/umd/compounds.production.js +1 -1
- package/dist/umd/n4s.development.js +132 -130
- package/dist/umd/n4s.production.js +1 -1
- package/dist/umd/schema.development.js +37 -37
- package/dist/umd/schema.production.js +1 -1
- package/package.json +3 -2
- package/types/compose.d.ts +14 -30
- package/types/compounds.d.ts +14 -30
- package/types/n4s.d.ts +14 -30
- package/types/schema.d.ts +14 -30
|
@@ -4,19 +4,16 @@
|
|
|
4
4
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.schema = {}, global.n4s));
|
|
5
5
|
}(this, (function (exports, n4s) { 'use strict';
|
|
6
6
|
|
|
7
|
-
function
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
broke = true;
|
|
18
|
-
breakoutValue = value;
|
|
19
|
-
}
|
|
7
|
+
function isNull(value) {
|
|
8
|
+
return value === null;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function isUndefined(value) {
|
|
12
|
+
return value === undefined;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function isNullish(value) {
|
|
16
|
+
return isNull(value) || isUndefined(value);
|
|
20
17
|
}
|
|
21
18
|
|
|
22
19
|
function isFunction(value) {
|
|
@@ -31,9 +28,33 @@
|
|
|
31
28
|
return isFunction(value) ? value.apply(void 0, args) : value;
|
|
32
29
|
}
|
|
33
30
|
|
|
34
|
-
function defaultTo(
|
|
31
|
+
function defaultTo(value, defaultValue) {
|
|
35
32
|
var _a;
|
|
36
|
-
return (_a = optionalFunctionValue(
|
|
33
|
+
return (_a = optionalFunctionValue(value)) !== null && _a !== void 0 ? _a : optionalFunctionValue(defaultValue);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* A safe hasOwnProperty access
|
|
38
|
+
*/
|
|
39
|
+
function hasOwnProperty(obj, key) {
|
|
40
|
+
return Object.prototype.hasOwnProperty.call(obj, key);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function mapFirst(array, callback) {
|
|
44
|
+
var broke = false;
|
|
45
|
+
var breakoutValue = null;
|
|
46
|
+
for (var i = 0; i < array.length; i++) {
|
|
47
|
+
callback(array[i], breakout, i);
|
|
48
|
+
if (broke) {
|
|
49
|
+
return breakoutValue;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function breakout(conditional, value) {
|
|
53
|
+
if (conditional) {
|
|
54
|
+
broke = true;
|
|
55
|
+
breakoutValue = value;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
37
58
|
}
|
|
38
59
|
|
|
39
60
|
function ruleReturn(pass, message) {
|
|
@@ -65,9 +86,7 @@
|
|
|
65
86
|
function isArrayOf(inputArray, currentRule) {
|
|
66
87
|
return defaultToPassing(mapFirst(inputArray, function (currentValue, breakout, index) {
|
|
67
88
|
var res = n4s.ctx.run({ value: currentValue, set: true, meta: { index: index } }, function () { return runLazyRule(currentRule, currentValue); });
|
|
68
|
-
|
|
69
|
-
breakout(res);
|
|
70
|
-
}
|
|
89
|
+
breakout(!res.pass, res);
|
|
71
90
|
}));
|
|
72
91
|
}
|
|
73
92
|
|
|
@@ -90,18 +109,6 @@
|
|
|
90
109
|
return passing();
|
|
91
110
|
}
|
|
92
111
|
|
|
93
|
-
function isNull(value) {
|
|
94
|
-
return value === null;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
function isUndefined(value) {
|
|
98
|
-
return value === undefined;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
function isNullish(value) {
|
|
102
|
-
return isNull(value) || isUndefined(value);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
112
|
function optional(value, ruleChain) {
|
|
106
113
|
if (isNullish(value)) {
|
|
107
114
|
return passing();
|
|
@@ -109,13 +116,6 @@
|
|
|
109
116
|
return runLazyRule(ruleChain, value);
|
|
110
117
|
}
|
|
111
118
|
|
|
112
|
-
/**
|
|
113
|
-
* A safe hasOwnProperty access
|
|
114
|
-
*/
|
|
115
|
-
function hasOwnProperty(obj, key) {
|
|
116
|
-
return Object.prototype.hasOwnProperty.call(obj, key);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
119
|
function shape(inputObject, shapeObject) {
|
|
120
120
|
var baseRes = loose(inputObject, shapeObject);
|
|
121
121
|
if (!baseRes.pass) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("n4s")):"function"==typeof define&&define.amd?define(["exports","n4s"],e):e((n="undefined"!=typeof globalThis?globalThis:n||self).schema={},n.n4s)}(this,(function(n,e){function t(n,e){return n={pass:n},e&&(n.message=e),n}function
|
|
1
|
+
"use strict";!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("n4s")):"function"==typeof define&&define.amd?define(["exports","n4s"],e):e((n="undefined"!=typeof globalThis?globalThis:n||self).schema={},n.n4s)}(this,(function(n,e){function t(n){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];return"function"==typeof n?n.apply(void 0,e):n}function r(n,e){return n={pass:n},e&&(n.message=e),n}function o(n,e){try{return n.run(e)}catch(n){return r(!1)}}function u(n,t){var u,f=function(r){var u=n[r],f=t[r];if(!(r=e.ctx.run({value:u,set:!0,meta:{key:r}},(function(){return o(f,u)}))).pass)return{value:r}};for(u in t){var i=f(u);if("object"==typeof i)return i.value}return r(!0)}e.enforce.extend({isArrayOf:function(n,u){return function(n,e){var r;return null!==(r=t(n))&&void 0!==r?r:t(e)}(function(n,e){function t(n,e){n&&(r=!0,o=e)}for(var r=!1,o=null,u=0;u<n.length;u++)if(e(n[u],t,u),r)return o}(n,(function(n,t,r){t(!(r=e.ctx.run({value:n,set:!0,meta:{index:r}},(function(){return o(u,n)}))).pass,r)})),r(!0))},loose:u,optional:function(n,e){return null==n?r(!0):o(e,n)},shape:function(n,e){var t=u(n,e);if(!t.pass)return t;for(var o in n)if(!Object.prototype.hasOwnProperty.call(e,o))return r(!1);return r(!0)}}),n.partial=function(n){var t,r={};for(t in n)r[t]=e.enforce.optional(n[t]);return r},Object.defineProperty(n,"__esModule",{value:!0})}));
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "4.1.
|
|
2
|
+
"version": "4.1.8-dev-ae93bf",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"main": "./dist/cjs/n4s.js",
|
|
5
5
|
"types": "./types/n4s.d.ts",
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
"release": "vx release"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"context": "^2.0.
|
|
13
|
+
"context": "^2.0.7-dev-ae93bf",
|
|
14
|
+
"vest-utils": "^0.0.4-dev-ae93bf"
|
|
14
15
|
},
|
|
15
16
|
"module": "./dist/es/n4s.production.js",
|
|
16
17
|
"exports": {
|
package/types/compose.d.ts
CHANGED
|
@@ -17,36 +17,20 @@ type KBaseRules = keyof BaseRules;
|
|
|
17
17
|
declare function condition(value: any, callback: (value: any) => RuleReturn): RuleReturn;
|
|
18
18
|
declare function endsWith(value: string, arg1: string): boolean;
|
|
19
19
|
declare function equals(value: unknown, arg1: unknown): boolean;
|
|
20
|
-
declare function greaterThan(value: number | string, gt: number | string): boolean;
|
|
21
20
|
declare function greaterThanOrEquals(value: string | number, gte: string | number): boolean;
|
|
22
21
|
declare function inside(value: unknown, arg1: string | unknown[]): boolean;
|
|
23
|
-
// The module is named "isArrayValue" since it
|
|
24
|
-
// is conflicting with a nested npm dependency.
|
|
25
|
-
// We may need to revisit this in the future.
|
|
26
|
-
declare function isArray(value: unknown): value is Array<unknown>;
|
|
27
22
|
declare function isBetween(value: number | string, min: number | string, max: number | string): boolean;
|
|
28
23
|
declare function isBlank(value: unknown): boolean;
|
|
29
|
-
declare function isBoolean(value: unknown): value is boolean;
|
|
30
|
-
declare function isEmpty(value: unknown): boolean;
|
|
31
24
|
declare function isKeyOf(key: string | symbol | number, obj: any): boolean;
|
|
32
25
|
declare function isNaN(value: unknown): boolean;
|
|
33
26
|
declare function isNegative(value: number | string): boolean;
|
|
34
|
-
declare function isNull(value: unknown): value is null;
|
|
35
|
-
declare function isNullish(value: any): value is null | undefined;
|
|
36
27
|
declare function isNumber(value: unknown): value is number;
|
|
37
|
-
declare function isNumeric(value: string | number): boolean;
|
|
38
|
-
declare function isPositive(value: number | string): boolean;
|
|
39
|
-
declare function isStringValue(v: unknown): v is string;
|
|
40
28
|
declare function isTruthy(value: unknown): boolean;
|
|
41
|
-
declare function isUndefined(value?: unknown): boolean;
|
|
42
29
|
declare function isValueOf(value: any, objectToCheck: any): boolean;
|
|
43
|
-
declare function lengthEquals(value: string | unknown[], arg1: string | number): boolean;
|
|
44
30
|
declare function lessThan(value: string | number, lt: string | number): boolean;
|
|
45
31
|
declare function lessThanOrEquals(value: string | number, lte: string | number): boolean;
|
|
46
|
-
declare function longerThan(value: string | unknown[], arg1: string | number): boolean;
|
|
47
32
|
declare function longerThanOrEquals(value: string | unknown[], arg1: string | number): boolean;
|
|
48
33
|
declare function matches(value: string, regex: RegExp | string): boolean;
|
|
49
|
-
declare function numberEquals(value: string | number, eq: string | number): boolean;
|
|
50
34
|
declare function shorterThan(value: string | unknown[], arg1: string | number): boolean;
|
|
51
35
|
declare function shorterThanOrEquals(value: string | unknown[], arg1: string | number): boolean;
|
|
52
36
|
declare function startsWith(value: string, arg1: string): boolean;
|
|
@@ -56,16 +40,16 @@ declare const baseRules: {
|
|
|
56
40
|
doesNotStartWith: (value: string, arg1: string) => boolean;
|
|
57
41
|
endsWith: typeof endsWith;
|
|
58
42
|
equals: typeof equals;
|
|
59
|
-
greaterThan: typeof greaterThan;
|
|
43
|
+
greaterThan: typeof import("packages/vest-utils/types/vest-utils").greaterThan;
|
|
60
44
|
greaterThanOrEquals: typeof greaterThanOrEquals;
|
|
61
|
-
gt: typeof greaterThan;
|
|
45
|
+
gt: typeof import("packages/vest-utils/types/vest-utils").greaterThan;
|
|
62
46
|
gte: typeof greaterThanOrEquals;
|
|
63
47
|
inside: typeof inside;
|
|
64
|
-
isArray: typeof isArray;
|
|
48
|
+
isArray: typeof import("packages/vest-utils/types/vest-utils").isArray;
|
|
65
49
|
isBetween: typeof isBetween;
|
|
66
50
|
isBlank: typeof isBlank;
|
|
67
|
-
isBoolean: typeof isBoolean;
|
|
68
|
-
isEmpty: typeof isEmpty;
|
|
51
|
+
isBoolean: typeof import("packages/vest-utils/types/vest-utils").isBoolean;
|
|
52
|
+
isEmpty: typeof import("packages/vest-utils/types/vest-utils").isEmpty;
|
|
69
53
|
isEven: (value: any) => boolean;
|
|
70
54
|
isFalsy: (value: unknown) => boolean;
|
|
71
55
|
isKeyOf: typeof isKeyOf;
|
|
@@ -85,21 +69,21 @@ declare const baseRules: {
|
|
|
85
69
|
isNotString: (v: unknown) => boolean;
|
|
86
70
|
isNotUndefined: (value?: unknown) => boolean;
|
|
87
71
|
isNotValueOf: (value: any, objectToCheck: any) => boolean;
|
|
88
|
-
isNull: typeof isNull;
|
|
89
|
-
isNullish: typeof isNullish;
|
|
72
|
+
isNull: typeof import("packages/vest-utils/types/vest-utils").isNull;
|
|
73
|
+
isNullish: typeof import("packages/vest-utils/types/vest-utils").isNullish;
|
|
90
74
|
isNumber: typeof isNumber;
|
|
91
|
-
isNumeric: typeof isNumeric;
|
|
75
|
+
isNumeric: typeof import("packages/vest-utils/types/vest-utils").isNumeric;
|
|
92
76
|
isOdd: (value: any) => boolean;
|
|
93
|
-
isPositive: typeof isPositive;
|
|
94
|
-
isString: typeof isStringValue;
|
|
77
|
+
isPositive: typeof import("packages/vest-utils/types/vest-utils").isPositive;
|
|
78
|
+
isString: typeof import("packages/vest-utils/types/vest-utils").isStringValue;
|
|
95
79
|
isTruthy: typeof isTruthy;
|
|
96
|
-
isUndefined: typeof isUndefined;
|
|
80
|
+
isUndefined: typeof import("packages/vest-utils/types/vest-utils").isUndefined;
|
|
97
81
|
isValueOf: typeof isValueOf;
|
|
98
|
-
lengthEquals: typeof lengthEquals;
|
|
82
|
+
lengthEquals: typeof import("packages/vest-utils/types/vest-utils").lengthEquals;
|
|
99
83
|
lengthNotEquals: (value: string | unknown[], arg1: string | number) => boolean;
|
|
100
84
|
lessThan: typeof lessThan;
|
|
101
85
|
lessThanOrEquals: typeof lessThanOrEquals;
|
|
102
|
-
longerThan: typeof longerThan;
|
|
86
|
+
longerThan: typeof import("packages/vest-utils/types/vest-utils").longerThan;
|
|
103
87
|
longerThanOrEquals: typeof longerThanOrEquals;
|
|
104
88
|
lt: typeof lessThan;
|
|
105
89
|
lte: typeof lessThanOrEquals;
|
|
@@ -107,7 +91,7 @@ declare const baseRules: {
|
|
|
107
91
|
notEquals: (value: unknown, arg1: unknown) => boolean;
|
|
108
92
|
notInside: (value: unknown, arg1: string | unknown[]) => boolean;
|
|
109
93
|
notMatches: (value: string, regex: string | RegExp) => boolean;
|
|
110
|
-
numberEquals: typeof numberEquals;
|
|
94
|
+
numberEquals: typeof import("packages/vest-utils/types/vest-utils").numberEquals;
|
|
111
95
|
numberNotEquals: (value: string | number, eq: string | number) => boolean;
|
|
112
96
|
shorterThan: typeof shorterThan;
|
|
113
97
|
shorterThanOrEquals: typeof shorterThanOrEquals;
|
package/types/compounds.d.ts
CHANGED
|
@@ -17,36 +17,20 @@ type KBaseRules = keyof BaseRules;
|
|
|
17
17
|
declare function condition(value: any, callback: (value: any) => RuleReturn): RuleReturn;
|
|
18
18
|
declare function endsWith(value: string, arg1: string): boolean;
|
|
19
19
|
declare function equals(value: unknown, arg1: unknown): boolean;
|
|
20
|
-
declare function greaterThan(value: number | string, gt: number | string): boolean;
|
|
21
20
|
declare function greaterThanOrEquals(value: string | number, gte: string | number): boolean;
|
|
22
21
|
declare function inside(value: unknown, arg1: string | unknown[]): boolean;
|
|
23
|
-
// The module is named "isArrayValue" since it
|
|
24
|
-
// is conflicting with a nested npm dependency.
|
|
25
|
-
// We may need to revisit this in the future.
|
|
26
|
-
declare function isArray(value: unknown): value is Array<unknown>;
|
|
27
22
|
declare function isBetween(value: number | string, min: number | string, max: number | string): boolean;
|
|
28
23
|
declare function isBlank(value: unknown): boolean;
|
|
29
|
-
declare function isBoolean(value: unknown): value is boolean;
|
|
30
|
-
declare function isEmpty(value: unknown): boolean;
|
|
31
24
|
declare function isKeyOf(key: string | symbol | number, obj: any): boolean;
|
|
32
25
|
declare function isNaN(value: unknown): boolean;
|
|
33
26
|
declare function isNegative(value: number | string): boolean;
|
|
34
|
-
declare function isNull(value: unknown): value is null;
|
|
35
|
-
declare function isNullish(value: any): value is null | undefined;
|
|
36
27
|
declare function isNumber(value: unknown): value is number;
|
|
37
|
-
declare function isNumeric(value: string | number): boolean;
|
|
38
|
-
declare function isPositive(value: number | string): boolean;
|
|
39
|
-
declare function isStringValue(v: unknown): v is string;
|
|
40
28
|
declare function isTruthy(value: unknown): boolean;
|
|
41
|
-
declare function isUndefined(value?: unknown): boolean;
|
|
42
29
|
declare function isValueOf(value: any, objectToCheck: any): boolean;
|
|
43
|
-
declare function lengthEquals(value: string | unknown[], arg1: string | number): boolean;
|
|
44
30
|
declare function lessThan(value: string | number, lt: string | number): boolean;
|
|
45
31
|
declare function lessThanOrEquals(value: string | number, lte: string | number): boolean;
|
|
46
|
-
declare function longerThan(value: string | unknown[], arg1: string | number): boolean;
|
|
47
32
|
declare function longerThanOrEquals(value: string | unknown[], arg1: string | number): boolean;
|
|
48
33
|
declare function matches(value: string, regex: RegExp | string): boolean;
|
|
49
|
-
declare function numberEquals(value: string | number, eq: string | number): boolean;
|
|
50
34
|
declare function shorterThan(value: string | unknown[], arg1: string | number): boolean;
|
|
51
35
|
declare function shorterThanOrEquals(value: string | unknown[], arg1: string | number): boolean;
|
|
52
36
|
declare function startsWith(value: string, arg1: string): boolean;
|
|
@@ -56,16 +40,16 @@ declare const baseRules: {
|
|
|
56
40
|
doesNotStartWith: (value: string, arg1: string) => boolean;
|
|
57
41
|
endsWith: typeof endsWith;
|
|
58
42
|
equals: typeof equals;
|
|
59
|
-
greaterThan: typeof greaterThan;
|
|
43
|
+
greaterThan: typeof import("packages/vest-utils/types/vest-utils").greaterThan;
|
|
60
44
|
greaterThanOrEquals: typeof greaterThanOrEquals;
|
|
61
|
-
gt: typeof greaterThan;
|
|
45
|
+
gt: typeof import("packages/vest-utils/types/vest-utils").greaterThan;
|
|
62
46
|
gte: typeof greaterThanOrEquals;
|
|
63
47
|
inside: typeof inside;
|
|
64
|
-
isArray: typeof isArray;
|
|
48
|
+
isArray: typeof import("packages/vest-utils/types/vest-utils").isArray;
|
|
65
49
|
isBetween: typeof isBetween;
|
|
66
50
|
isBlank: typeof isBlank;
|
|
67
|
-
isBoolean: typeof isBoolean;
|
|
68
|
-
isEmpty: typeof isEmpty;
|
|
51
|
+
isBoolean: typeof import("packages/vest-utils/types/vest-utils").isBoolean;
|
|
52
|
+
isEmpty: typeof import("packages/vest-utils/types/vest-utils").isEmpty;
|
|
69
53
|
isEven: (value: any) => boolean;
|
|
70
54
|
isFalsy: (value: unknown) => boolean;
|
|
71
55
|
isKeyOf: typeof isKeyOf;
|
|
@@ -85,21 +69,21 @@ declare const baseRules: {
|
|
|
85
69
|
isNotString: (v: unknown) => boolean;
|
|
86
70
|
isNotUndefined: (value?: unknown) => boolean;
|
|
87
71
|
isNotValueOf: (value: any, objectToCheck: any) => boolean;
|
|
88
|
-
isNull: typeof isNull;
|
|
89
|
-
isNullish: typeof isNullish;
|
|
72
|
+
isNull: typeof import("packages/vest-utils/types/vest-utils").isNull;
|
|
73
|
+
isNullish: typeof import("packages/vest-utils/types/vest-utils").isNullish;
|
|
90
74
|
isNumber: typeof isNumber;
|
|
91
|
-
isNumeric: typeof isNumeric;
|
|
75
|
+
isNumeric: typeof import("packages/vest-utils/types/vest-utils").isNumeric;
|
|
92
76
|
isOdd: (value: any) => boolean;
|
|
93
|
-
isPositive: typeof isPositive;
|
|
94
|
-
isString: typeof isStringValue;
|
|
77
|
+
isPositive: typeof import("packages/vest-utils/types/vest-utils").isPositive;
|
|
78
|
+
isString: typeof import("packages/vest-utils/types/vest-utils").isStringValue;
|
|
95
79
|
isTruthy: typeof isTruthy;
|
|
96
|
-
isUndefined: typeof isUndefined;
|
|
80
|
+
isUndefined: typeof import("packages/vest-utils/types/vest-utils").isUndefined;
|
|
97
81
|
isValueOf: typeof isValueOf;
|
|
98
|
-
lengthEquals: typeof lengthEquals;
|
|
82
|
+
lengthEquals: typeof import("packages/vest-utils/types/vest-utils").lengthEquals;
|
|
99
83
|
lengthNotEquals: (value: string | unknown[], arg1: string | number) => boolean;
|
|
100
84
|
lessThan: typeof lessThan;
|
|
101
85
|
lessThanOrEquals: typeof lessThanOrEquals;
|
|
102
|
-
longerThan: typeof longerThan;
|
|
86
|
+
longerThan: typeof import("packages/vest-utils/types/vest-utils").longerThan;
|
|
103
87
|
longerThanOrEquals: typeof longerThanOrEquals;
|
|
104
88
|
lt: typeof lessThan;
|
|
105
89
|
lte: typeof lessThanOrEquals;
|
|
@@ -107,7 +91,7 @@ declare const baseRules: {
|
|
|
107
91
|
notEquals: (value: unknown, arg1: unknown) => boolean;
|
|
108
92
|
notInside: (value: unknown, arg1: string | unknown[]) => boolean;
|
|
109
93
|
notMatches: (value: string, regex: string | RegExp) => boolean;
|
|
110
|
-
numberEquals: typeof numberEquals;
|
|
94
|
+
numberEquals: typeof import("packages/vest-utils/types/vest-utils").numberEquals;
|
|
111
95
|
numberNotEquals: (value: string | number, eq: string | number) => boolean;
|
|
112
96
|
shorterThan: typeof shorterThan;
|
|
113
97
|
shorterThanOrEquals: typeof shorterThanOrEquals;
|
package/types/n4s.d.ts
CHANGED
|
@@ -37,36 +37,20 @@ type KBaseRules = keyof BaseRules;
|
|
|
37
37
|
declare function condition(value: any, callback: (value: any) => RuleReturn): RuleReturn;
|
|
38
38
|
declare function endsWith(value: string, arg1: string): boolean;
|
|
39
39
|
declare function equals(value: unknown, arg1: unknown): boolean;
|
|
40
|
-
declare function greaterThan(value: number | string, gt: number | string): boolean;
|
|
41
40
|
declare function greaterThanOrEquals(value: string | number, gte: string | number): boolean;
|
|
42
41
|
declare function inside(value: unknown, arg1: string | unknown[]): boolean;
|
|
43
|
-
// The module is named "isArrayValue" since it
|
|
44
|
-
// is conflicting with a nested npm dependency.
|
|
45
|
-
// We may need to revisit this in the future.
|
|
46
|
-
declare function isArray(value: unknown): value is Array<unknown>;
|
|
47
42
|
declare function isBetween(value: number | string, min: number | string, max: number | string): boolean;
|
|
48
43
|
declare function isBlank(value: unknown): boolean;
|
|
49
|
-
declare function isBoolean(value: unknown): value is boolean;
|
|
50
|
-
declare function isEmpty(value: unknown): boolean;
|
|
51
44
|
declare function isKeyOf(key: string | symbol | number, obj: any): boolean;
|
|
52
45
|
declare function isNaN(value: unknown): boolean;
|
|
53
46
|
declare function isNegative(value: number | string): boolean;
|
|
54
|
-
declare function isNull(value: unknown): value is null;
|
|
55
|
-
declare function isNullish(value: any): value is null | undefined;
|
|
56
47
|
declare function isNumber(value: unknown): value is number;
|
|
57
|
-
declare function isNumeric(value: string | number): boolean;
|
|
58
|
-
declare function isPositive(value: number | string): boolean;
|
|
59
|
-
declare function isStringValue(v: unknown): v is string;
|
|
60
48
|
declare function isTruthy(value: unknown): boolean;
|
|
61
|
-
declare function isUndefined(value?: unknown): boolean;
|
|
62
49
|
declare function isValueOf(value: any, objectToCheck: any): boolean;
|
|
63
|
-
declare function lengthEquals(value: string | unknown[], arg1: string | number): boolean;
|
|
64
50
|
declare function lessThan(value: string | number, lt: string | number): boolean;
|
|
65
51
|
declare function lessThanOrEquals(value: string | number, lte: string | number): boolean;
|
|
66
|
-
declare function longerThan(value: string | unknown[], arg1: string | number): boolean;
|
|
67
52
|
declare function longerThanOrEquals(value: string | unknown[], arg1: string | number): boolean;
|
|
68
53
|
declare function matches(value: string, regex: RegExp | string): boolean;
|
|
69
|
-
declare function numberEquals(value: string | number, eq: string | number): boolean;
|
|
70
54
|
declare function shorterThan(value: string | unknown[], arg1: string | number): boolean;
|
|
71
55
|
declare function shorterThanOrEquals(value: string | unknown[], arg1: string | number): boolean;
|
|
72
56
|
declare function startsWith(value: string, arg1: string): boolean;
|
|
@@ -76,16 +60,16 @@ declare const baseRules: {
|
|
|
76
60
|
doesNotStartWith: (value: string, arg1: string) => boolean;
|
|
77
61
|
endsWith: typeof endsWith;
|
|
78
62
|
equals: typeof equals;
|
|
79
|
-
greaterThan: typeof greaterThan;
|
|
63
|
+
greaterThan: typeof import("packages/vest-utils/types/vest-utils").greaterThan;
|
|
80
64
|
greaterThanOrEquals: typeof greaterThanOrEquals;
|
|
81
|
-
gt: typeof greaterThan;
|
|
65
|
+
gt: typeof import("packages/vest-utils/types/vest-utils").greaterThan;
|
|
82
66
|
gte: typeof greaterThanOrEquals;
|
|
83
67
|
inside: typeof inside;
|
|
84
|
-
isArray: typeof isArray;
|
|
68
|
+
isArray: typeof import("packages/vest-utils/types/vest-utils").isArray;
|
|
85
69
|
isBetween: typeof isBetween;
|
|
86
70
|
isBlank: typeof isBlank;
|
|
87
|
-
isBoolean: typeof isBoolean;
|
|
88
|
-
isEmpty: typeof isEmpty;
|
|
71
|
+
isBoolean: typeof import("packages/vest-utils/types/vest-utils").isBoolean;
|
|
72
|
+
isEmpty: typeof import("packages/vest-utils/types/vest-utils").isEmpty;
|
|
89
73
|
isEven: (value: any) => boolean;
|
|
90
74
|
isFalsy: (value: unknown) => boolean;
|
|
91
75
|
isKeyOf: typeof isKeyOf;
|
|
@@ -105,21 +89,21 @@ declare const baseRules: {
|
|
|
105
89
|
isNotString: (v: unknown) => boolean;
|
|
106
90
|
isNotUndefined: (value?: unknown) => boolean;
|
|
107
91
|
isNotValueOf: (value: any, objectToCheck: any) => boolean;
|
|
108
|
-
isNull: typeof isNull;
|
|
109
|
-
isNullish: typeof isNullish;
|
|
92
|
+
isNull: typeof import("packages/vest-utils/types/vest-utils").isNull;
|
|
93
|
+
isNullish: typeof import("packages/vest-utils/types/vest-utils").isNullish;
|
|
110
94
|
isNumber: typeof isNumber;
|
|
111
|
-
isNumeric: typeof isNumeric;
|
|
95
|
+
isNumeric: typeof import("packages/vest-utils/types/vest-utils").isNumeric;
|
|
112
96
|
isOdd: (value: any) => boolean;
|
|
113
|
-
isPositive: typeof isPositive;
|
|
114
|
-
isString: typeof isStringValue;
|
|
97
|
+
isPositive: typeof import("packages/vest-utils/types/vest-utils").isPositive;
|
|
98
|
+
isString: typeof import("packages/vest-utils/types/vest-utils").isStringValue;
|
|
115
99
|
isTruthy: typeof isTruthy;
|
|
116
|
-
isUndefined: typeof isUndefined;
|
|
100
|
+
isUndefined: typeof import("packages/vest-utils/types/vest-utils").isUndefined;
|
|
117
101
|
isValueOf: typeof isValueOf;
|
|
118
|
-
lengthEquals: typeof lengthEquals;
|
|
102
|
+
lengthEquals: typeof import("packages/vest-utils/types/vest-utils").lengthEquals;
|
|
119
103
|
lengthNotEquals: (value: string | unknown[], arg1: string | number) => boolean;
|
|
120
104
|
lessThan: typeof lessThan;
|
|
121
105
|
lessThanOrEquals: typeof lessThanOrEquals;
|
|
122
|
-
longerThan: typeof longerThan;
|
|
106
|
+
longerThan: typeof import("packages/vest-utils/types/vest-utils").longerThan;
|
|
123
107
|
longerThanOrEquals: typeof longerThanOrEquals;
|
|
124
108
|
lt: typeof lessThan;
|
|
125
109
|
lte: typeof lessThanOrEquals;
|
|
@@ -127,7 +111,7 @@ declare const baseRules: {
|
|
|
127
111
|
notEquals: (value: unknown, arg1: unknown) => boolean;
|
|
128
112
|
notInside: (value: unknown, arg1: string | unknown[]) => boolean;
|
|
129
113
|
notMatches: (value: string, regex: string | RegExp) => boolean;
|
|
130
|
-
numberEquals: typeof numberEquals;
|
|
114
|
+
numberEquals: typeof import("packages/vest-utils/types/vest-utils").numberEquals;
|
|
131
115
|
numberNotEquals: (value: string | number, eq: string | number) => boolean;
|
|
132
116
|
shorterThan: typeof shorterThan;
|
|
133
117
|
shorterThanOrEquals: typeof shorterThanOrEquals;
|
package/types/schema.d.ts
CHANGED
|
@@ -17,36 +17,20 @@ type KBaseRules = keyof BaseRules;
|
|
|
17
17
|
declare function condition(value: any, callback: (value: any) => RuleReturn): RuleReturn;
|
|
18
18
|
declare function endsWith(value: string, arg1: string): boolean;
|
|
19
19
|
declare function equals(value: unknown, arg1: unknown): boolean;
|
|
20
|
-
declare function greaterThan(value: number | string, gt: number | string): boolean;
|
|
21
20
|
declare function greaterThanOrEquals(value: string | number, gte: string | number): boolean;
|
|
22
21
|
declare function inside(value: unknown, arg1: string | unknown[]): boolean;
|
|
23
|
-
// The module is named "isArrayValue" since it
|
|
24
|
-
// is conflicting with a nested npm dependency.
|
|
25
|
-
// We may need to revisit this in the future.
|
|
26
|
-
declare function isArray(value: unknown): value is Array<unknown>;
|
|
27
22
|
declare function isBetween(value: number | string, min: number | string, max: number | string): boolean;
|
|
28
23
|
declare function isBlank(value: unknown): boolean;
|
|
29
|
-
declare function isBoolean(value: unknown): value is boolean;
|
|
30
|
-
declare function isEmpty(value: unknown): boolean;
|
|
31
24
|
declare function isKeyOf(key: string | symbol | number, obj: any): boolean;
|
|
32
25
|
declare function isNaN(value: unknown): boolean;
|
|
33
26
|
declare function isNegative(value: number | string): boolean;
|
|
34
|
-
declare function isNull(value: unknown): value is null;
|
|
35
|
-
declare function isNullish(value: any): value is null | undefined;
|
|
36
27
|
declare function isNumber(value: unknown): value is number;
|
|
37
|
-
declare function isNumeric(value: string | number): boolean;
|
|
38
|
-
declare function isPositive(value: number | string): boolean;
|
|
39
|
-
declare function isStringValue(v: unknown): v is string;
|
|
40
28
|
declare function isTruthy(value: unknown): boolean;
|
|
41
|
-
declare function isUndefined(value?: unknown): boolean;
|
|
42
29
|
declare function isValueOf(value: any, objectToCheck: any): boolean;
|
|
43
|
-
declare function lengthEquals(value: string | unknown[], arg1: string | number): boolean;
|
|
44
30
|
declare function lessThan(value: string | number, lt: string | number): boolean;
|
|
45
31
|
declare function lessThanOrEquals(value: string | number, lte: string | number): boolean;
|
|
46
|
-
declare function longerThan(value: string | unknown[], arg1: string | number): boolean;
|
|
47
32
|
declare function longerThanOrEquals(value: string | unknown[], arg1: string | number): boolean;
|
|
48
33
|
declare function matches(value: string, regex: RegExp | string): boolean;
|
|
49
|
-
declare function numberEquals(value: string | number, eq: string | number): boolean;
|
|
50
34
|
declare function shorterThan(value: string | unknown[], arg1: string | number): boolean;
|
|
51
35
|
declare function shorterThanOrEquals(value: string | unknown[], arg1: string | number): boolean;
|
|
52
36
|
declare function startsWith(value: string, arg1: string): boolean;
|
|
@@ -56,16 +40,16 @@ declare const baseRules: {
|
|
|
56
40
|
doesNotStartWith: (value: string, arg1: string) => boolean;
|
|
57
41
|
endsWith: typeof endsWith;
|
|
58
42
|
equals: typeof equals;
|
|
59
|
-
greaterThan: typeof greaterThan;
|
|
43
|
+
greaterThan: typeof import("packages/vest-utils/types/vest-utils").greaterThan;
|
|
60
44
|
greaterThanOrEquals: typeof greaterThanOrEquals;
|
|
61
|
-
gt: typeof greaterThan;
|
|
45
|
+
gt: typeof import("packages/vest-utils/types/vest-utils").greaterThan;
|
|
62
46
|
gte: typeof greaterThanOrEquals;
|
|
63
47
|
inside: typeof inside;
|
|
64
|
-
isArray: typeof isArray;
|
|
48
|
+
isArray: typeof import("packages/vest-utils/types/vest-utils").isArray;
|
|
65
49
|
isBetween: typeof isBetween;
|
|
66
50
|
isBlank: typeof isBlank;
|
|
67
|
-
isBoolean: typeof isBoolean;
|
|
68
|
-
isEmpty: typeof isEmpty;
|
|
51
|
+
isBoolean: typeof import("packages/vest-utils/types/vest-utils").isBoolean;
|
|
52
|
+
isEmpty: typeof import("packages/vest-utils/types/vest-utils").isEmpty;
|
|
69
53
|
isEven: (value: any) => boolean;
|
|
70
54
|
isFalsy: (value: unknown) => boolean;
|
|
71
55
|
isKeyOf: typeof isKeyOf;
|
|
@@ -85,21 +69,21 @@ declare const baseRules: {
|
|
|
85
69
|
isNotString: (v: unknown) => boolean;
|
|
86
70
|
isNotUndefined: (value?: unknown) => boolean;
|
|
87
71
|
isNotValueOf: (value: any, objectToCheck: any) => boolean;
|
|
88
|
-
isNull: typeof isNull;
|
|
89
|
-
isNullish: typeof isNullish;
|
|
72
|
+
isNull: typeof import("packages/vest-utils/types/vest-utils").isNull;
|
|
73
|
+
isNullish: typeof import("packages/vest-utils/types/vest-utils").isNullish;
|
|
90
74
|
isNumber: typeof isNumber;
|
|
91
|
-
isNumeric: typeof isNumeric;
|
|
75
|
+
isNumeric: typeof import("packages/vest-utils/types/vest-utils").isNumeric;
|
|
92
76
|
isOdd: (value: any) => boolean;
|
|
93
|
-
isPositive: typeof isPositive;
|
|
94
|
-
isString: typeof isStringValue;
|
|
77
|
+
isPositive: typeof import("packages/vest-utils/types/vest-utils").isPositive;
|
|
78
|
+
isString: typeof import("packages/vest-utils/types/vest-utils").isStringValue;
|
|
95
79
|
isTruthy: typeof isTruthy;
|
|
96
|
-
isUndefined: typeof isUndefined;
|
|
80
|
+
isUndefined: typeof import("packages/vest-utils/types/vest-utils").isUndefined;
|
|
97
81
|
isValueOf: typeof isValueOf;
|
|
98
|
-
lengthEquals: typeof lengthEquals;
|
|
82
|
+
lengthEquals: typeof import("packages/vest-utils/types/vest-utils").lengthEquals;
|
|
99
83
|
lengthNotEquals: (value: string | unknown[], arg1: string | number) => boolean;
|
|
100
84
|
lessThan: typeof lessThan;
|
|
101
85
|
lessThanOrEquals: typeof lessThanOrEquals;
|
|
102
|
-
longerThan: typeof longerThan;
|
|
86
|
+
longerThan: typeof import("packages/vest-utils/types/vest-utils").longerThan;
|
|
103
87
|
longerThanOrEquals: typeof longerThanOrEquals;
|
|
104
88
|
lt: typeof lessThan;
|
|
105
89
|
lte: typeof lessThanOrEquals;
|
|
@@ -107,7 +91,7 @@ declare const baseRules: {
|
|
|
107
91
|
notEquals: (value: unknown, arg1: unknown) => boolean;
|
|
108
92
|
notInside: (value: unknown, arg1: string | unknown[]) => boolean;
|
|
109
93
|
notMatches: (value: string, regex: string | RegExp) => boolean;
|
|
110
|
-
numberEquals: typeof numberEquals;
|
|
94
|
+
numberEquals: typeof import("packages/vest-utils/types/vest-utils").numberEquals;
|
|
111
95
|
numberNotEquals: (value: string | number, eq: string | number) => boolean;
|
|
112
96
|
shorterThan: typeof shorterThan;
|
|
113
97
|
shorterThanOrEquals: typeof shorterThanOrEquals;
|