check-types-mini 7.0.5 → 7.0.6
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/check-types-mini.esm.js +170 -140
- package/dist/check-types-mini.umd.js +4 -4
- package/package.json +21 -25
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @name check-types-mini
|
|
3
3
|
* @fileoverview Validate options object
|
|
4
|
-
* @version 7.0.
|
|
4
|
+
* @version 7.0.6
|
|
5
5
|
* @author Roy Revelt, Codsen Ltd
|
|
6
6
|
* @license MIT
|
|
7
7
|
* {@link https://codsen.com/os/check-types-mini/}
|
|
@@ -16,165 +16,195 @@ import objectPath from 'object-path';
|
|
|
16
16
|
import { isMatch } from 'matcher';
|
|
17
17
|
|
|
18
18
|
const defaults = {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
19
|
+
ignoreKeys: [],
|
|
20
|
+
ignorePaths: [],
|
|
21
|
+
acceptArrays: false,
|
|
22
|
+
acceptArraysIgnore: [],
|
|
23
|
+
enforceStrictKeyset: true,
|
|
24
|
+
schema: {},
|
|
25
|
+
msg: "check-types-mini",
|
|
26
|
+
optsVarName: "opts",
|
|
27
27
|
};
|
|
28
28
|
function internalApi(obj, ref, originalOptions) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
function isObj(something) {
|
|
33
|
-
return typ(something) === "Object";
|
|
34
|
-
}
|
|
35
|
-
function pullAllWithGlob(originalInput, toBeRemoved) {
|
|
36
|
-
if (typeof toBeRemoved === "string") {
|
|
37
|
-
toBeRemoved = arrayiffy(toBeRemoved);
|
|
29
|
+
function existy(something) {
|
|
30
|
+
return something != null;
|
|
38
31
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
})));
|
|
42
|
-
}
|
|
43
|
-
const hasKey = Object.prototype.hasOwnProperty;
|
|
44
|
-
const NAMESFORANYTYPE = ["any", "anything", "every", "everything", "all", "whatever", "whatevs"];
|
|
45
|
-
if (!existy(obj)) {
|
|
46
|
-
throw new Error("check-types-mini: [THROW_ID_01] First argument is missing!");
|
|
47
|
-
}
|
|
48
|
-
const opts = { ...defaults,
|
|
49
|
-
...originalOptions
|
|
50
|
-
};
|
|
51
|
-
if (typeof opts.ignoreKeys === "string") {
|
|
52
|
-
opts.ignoreKeys = [opts.ignoreKeys];
|
|
53
|
-
}
|
|
54
|
-
if (typeof opts.ignorePaths === "string") {
|
|
55
|
-
opts.ignorePaths = [opts.ignorePaths];
|
|
56
|
-
}
|
|
57
|
-
if (typeof opts.acceptArraysIgnore === "string") {
|
|
58
|
-
opts.acceptArraysIgnore = [opts.acceptArraysIgnore];
|
|
59
|
-
}
|
|
60
|
-
opts.msg = `${opts.msg}`.trim();
|
|
61
|
-
if (opts.msg[opts.msg.length - 1] === ":") {
|
|
62
|
-
opts.msg = opts.msg.slice(0, opts.msg.length - 1).trim();
|
|
63
|
-
}
|
|
64
|
-
if (isObj(opts.schema)) {
|
|
65
|
-
Object.keys(opts.schema).forEach(oneKey => {
|
|
66
|
-
if (isObj(opts.schema[oneKey])) {
|
|
67
|
-
const tempObj = {};
|
|
68
|
-
traverse(opts.schema[oneKey], (key, val, innerObj) => {
|
|
69
|
-
const current = val !== undefined ? val : key;
|
|
70
|
-
if (!Array.isArray(current) && !isObj(current)) {
|
|
71
|
-
tempObj[`${oneKey}.${innerObj.path}`] = current;
|
|
72
|
-
}
|
|
73
|
-
return current;
|
|
74
|
-
});
|
|
75
|
-
delete opts.schema[oneKey];
|
|
76
|
-
opts.schema = { ...opts.schema,
|
|
77
|
-
...tempObj
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
Object.keys(opts.schema).forEach(oneKey => {
|
|
82
|
-
if (!Array.isArray(opts.schema[oneKey])) {
|
|
83
|
-
opts.schema[oneKey] = [opts.schema[oneKey]];
|
|
84
|
-
}
|
|
85
|
-
opts.schema[oneKey] = opts.schema[oneKey].map(el => `${el}`.toLowerCase().trim());
|
|
86
|
-
});
|
|
87
|
-
} else if (opts.schema != null) {
|
|
88
|
-
throw new Error(`check-types-mini: opts.schema was customised to ${JSON.stringify(opts.schema, null, 0)} which is not object but ${typeof opts.schema}`);
|
|
89
|
-
}
|
|
90
|
-
if (!existy(ref)) {
|
|
91
|
-
ref = {};
|
|
92
|
-
}
|
|
93
|
-
if (opts.enforceStrictKeyset) {
|
|
94
|
-
if (existy(opts.schema) && Object.keys(opts.schema).length > 0) {
|
|
95
|
-
if (ref && pullAllWithGlob(pullAll(Object.keys(obj), Object.keys(ref).concat(Object.keys(opts.schema))), opts.ignoreKeys).length) {
|
|
96
|
-
const keys = pullAll(Object.keys(obj), Object.keys(ref).concat(Object.keys(opts.schema)));
|
|
97
|
-
throw new TypeError(`${opts.msg}: ${opts.optsVarName}.enforceStrictKeyset is on and the following key${keys.length > 1 ? "s" : ""} ${keys.length > 1 ? "are" : "is"} not covered by schema and/or reference objects: ${keys.join(", ")}`);
|
|
98
|
-
}
|
|
99
|
-
} else if (isObj(ref) && Object.keys(ref).length > 0) {
|
|
100
|
-
if (pullAllWithGlob(pullAll(Object.keys(obj), Object.keys(ref)), opts.ignoreKeys).length !== 0) {
|
|
101
|
-
const keys = pullAll(Object.keys(obj), Object.keys(ref));
|
|
102
|
-
throw new TypeError(`${opts.msg}: The input object has key${keys.length > 1 ? "s" : ""} which ${keys.length > 1 ? "are" : "is"} not covered by the reference object: ${keys.join(", ")}`);
|
|
103
|
-
} else if (pullAllWithGlob(pullAll(Object.keys(ref), Object.keys(obj)), opts.ignoreKeys).length !== 0) {
|
|
104
|
-
const keys = pullAll(Object.keys(ref), Object.keys(obj));
|
|
105
|
-
throw new TypeError(`${opts.msg}: The reference object has key${keys.length > 1 ? "s" : ""} which ${keys.length > 1 ? "are" : "is"} not present in the input object: ${keys.join(", ")}`);
|
|
106
|
-
}
|
|
107
|
-
} else {
|
|
108
|
-
throw new TypeError(`${opts.msg}: Both ${opts.optsVarName}.schema and reference objects are missing! We don't have anything to match the keys as you requested via opts.enforceStrictKeyset!`);
|
|
32
|
+
function isObj(something) {
|
|
33
|
+
return typ(something) === "Object";
|
|
109
34
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
current = key;
|
|
35
|
+
function pullAllWithGlob(originalInput, toBeRemoved) {
|
|
36
|
+
if (typeof toBeRemoved === "string") {
|
|
37
|
+
toBeRemoved = arrayiffy(toBeRemoved);
|
|
38
|
+
}
|
|
39
|
+
return Array.from(originalInput).filter((originalVal) => !toBeRemoved.some((remVal) => isMatch(originalVal, remVal, {
|
|
40
|
+
caseSensitive: true,
|
|
41
|
+
})));
|
|
118
42
|
}
|
|
119
|
-
|
|
120
|
-
|
|
43
|
+
const hasKey = Object.prototype.hasOwnProperty;
|
|
44
|
+
const NAMESFORANYTYPE = [
|
|
45
|
+
"any",
|
|
46
|
+
"anything",
|
|
47
|
+
"every",
|
|
48
|
+
"everything",
|
|
49
|
+
"all",
|
|
50
|
+
"whatever",
|
|
51
|
+
"whatevs",
|
|
52
|
+
];
|
|
53
|
+
if (!existy(obj)) {
|
|
54
|
+
throw new Error("check-types-mini: [THROW_ID_01] First argument is missing!");
|
|
121
55
|
}
|
|
122
|
-
|
|
123
|
-
|
|
56
|
+
const opts = { ...defaults, ...originalOptions };
|
|
57
|
+
if (typeof opts.ignoreKeys === "string") {
|
|
58
|
+
opts.ignoreKeys = [opts.ignoreKeys];
|
|
124
59
|
}
|
|
125
|
-
if (opts.ignorePaths
|
|
126
|
-
|
|
60
|
+
if (typeof opts.ignorePaths === "string") {
|
|
61
|
+
opts.ignorePaths = [opts.ignorePaths];
|
|
127
62
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
if (isObj(opts.schema) && hasKey.call(opts.schema, innerObj.path)) {
|
|
131
|
-
optsSchemaHasThisPathDefined = true;
|
|
63
|
+
if (typeof opts.acceptArraysIgnore === "string") {
|
|
64
|
+
opts.acceptArraysIgnore = [opts.acceptArraysIgnore];
|
|
132
65
|
}
|
|
133
|
-
|
|
134
|
-
if (
|
|
135
|
-
|
|
66
|
+
opts.msg = `${opts.msg}`.trim();
|
|
67
|
+
if (opts.msg[opts.msg.length - 1] === ":") {
|
|
68
|
+
opts.msg = opts.msg.slice(0, opts.msg.length - 1).trim();
|
|
136
69
|
}
|
|
137
|
-
if (opts.
|
|
138
|
-
|
|
70
|
+
if (isObj(opts.schema)) {
|
|
71
|
+
Object.keys(opts.schema).forEach((oneKey) => {
|
|
72
|
+
if (isObj(opts.schema[oneKey])) {
|
|
73
|
+
const tempObj = {};
|
|
74
|
+
traverse(opts.schema[oneKey], (key, val, innerObj) => {
|
|
75
|
+
const current = val !== undefined ? val : key;
|
|
76
|
+
if (!Array.isArray(current) && !isObj(current)) {
|
|
77
|
+
tempObj[`${oneKey}.${innerObj.path}`] = current;
|
|
78
|
+
}
|
|
79
|
+
return current;
|
|
80
|
+
});
|
|
81
|
+
delete opts.schema[oneKey];
|
|
82
|
+
opts.schema = { ...opts.schema, ...tempObj };
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
Object.keys(opts.schema).forEach((oneKey) => {
|
|
86
|
+
if (!Array.isArray(opts.schema[oneKey])) {
|
|
87
|
+
opts.schema[oneKey] = [opts.schema[oneKey]];
|
|
88
|
+
}
|
|
89
|
+
opts.schema[oneKey] = opts.schema[oneKey].map((el) => `${el}`.toLowerCase().trim());
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
else if (opts.schema != null) {
|
|
93
|
+
throw new Error(`check-types-mini: opts.schema was customised to ${JSON.stringify(opts.schema, null, 0)} which is not object but ${typeof opts.schema}`);
|
|
94
|
+
}
|
|
95
|
+
if (!existy(ref)) {
|
|
96
|
+
ref = {};
|
|
97
|
+
}
|
|
98
|
+
if (opts.enforceStrictKeyset) {
|
|
99
|
+
if (existy(opts.schema) && Object.keys(opts.schema).length > 0) {
|
|
100
|
+
if (ref &&
|
|
101
|
+
pullAllWithGlob(pullAll(Object.keys(obj), Object.keys(ref).concat(Object.keys(opts.schema))), opts.ignoreKeys).length) {
|
|
102
|
+
const keys = pullAll(Object.keys(obj), Object.keys(ref).concat(Object.keys(opts.schema)));
|
|
103
|
+
throw new TypeError(`${opts.msg}: ${opts.optsVarName}.enforceStrictKeyset is on and the following key${keys.length > 1 ? "s" : ""} ${keys.length > 1 ? "are" : "is"} not covered by schema and/or reference objects: ${keys.join(", ")}`);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
else if (isObj(ref) && Object.keys(ref).length > 0) {
|
|
107
|
+
if (pullAllWithGlob(pullAll(Object.keys(obj), Object.keys(ref)), opts.ignoreKeys).length !== 0) {
|
|
108
|
+
const keys = pullAll(Object.keys(obj), Object.keys(ref));
|
|
109
|
+
throw new TypeError(`${opts.msg}: The input object has key${keys.length > 1 ? "s" : ""} which ${keys.length > 1 ? "are" : "is"} not covered by the reference object: ${keys.join(", ")}`);
|
|
110
|
+
}
|
|
111
|
+
else if (pullAllWithGlob(pullAll(Object.keys(ref), Object.keys(obj)), opts.ignoreKeys).length !== 0) {
|
|
112
|
+
const keys = pullAll(Object.keys(ref), Object.keys(obj));
|
|
113
|
+
throw new TypeError(`${opts.msg}: The reference object has key${keys.length > 1 ? "s" : ""} which ${keys.length > 1 ? "are" : "is"} not present in the input object: ${keys.join(", ")}`);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
throw new TypeError(`${opts.msg}: Both ${opts.optsVarName}.schema and reference objects are missing! We don't have anything to match the keys as you requested via opts.enforceStrictKeyset!`);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
const ignoredPathsArr = [];
|
|
121
|
+
traverse(obj, (key, val, innerObj) => {
|
|
122
|
+
let current = val;
|
|
123
|
+
let objKey = key;
|
|
124
|
+
if (innerObj.parentType === "array") {
|
|
125
|
+
objKey = undefined;
|
|
126
|
+
current = key;
|
|
127
|
+
}
|
|
128
|
+
if (Array.isArray(ignoredPathsArr) &&
|
|
129
|
+
ignoredPathsArr.length &&
|
|
130
|
+
ignoredPathsArr.some((path) => innerObj.path.startsWith(path))) {
|
|
131
|
+
return current;
|
|
132
|
+
}
|
|
133
|
+
if (objKey &&
|
|
134
|
+
opts.ignoreKeys.some((oneOfKeysToIgnore) => isMatch(objKey, oneOfKeysToIgnore))) {
|
|
135
|
+
return current;
|
|
136
|
+
}
|
|
137
|
+
if (opts.ignorePaths.some((oneOfPathsToIgnore) => isMatch(innerObj.path, oneOfPathsToIgnore))) {
|
|
138
|
+
return current;
|
|
139
|
+
}
|
|
140
|
+
const isNotAnArrayChild = !(!isObj(current) &&
|
|
141
|
+
!Array.isArray(current) &&
|
|
142
|
+
Array.isArray(innerObj.parent));
|
|
143
|
+
let optsSchemaHasThisPathDefined = false;
|
|
144
|
+
if (isObj(opts.schema) && hasKey.call(opts.schema, innerObj.path)) {
|
|
145
|
+
optsSchemaHasThisPathDefined = true;
|
|
146
|
+
}
|
|
147
|
+
let refHasThisPathDefined = false;
|
|
148
|
+
if (isObj(ref) && objectPath.has(ref, innerObj.path)) {
|
|
149
|
+
refHasThisPathDefined = true;
|
|
150
|
+
}
|
|
151
|
+
if (opts.enforceStrictKeyset &&
|
|
152
|
+
isNotAnArrayChild &&
|
|
153
|
+
!optsSchemaHasThisPathDefined &&
|
|
154
|
+
!refHasThisPathDefined) {
|
|
155
|
+
throw new TypeError(`${opts.msg}: ${opts.optsVarName}.${innerObj.path} is neither covered by reference object (second input argument), nor ${opts.optsVarName}.schema! To stop this error, turn off ${opts.optsVarName}.enforceStrictKeyset or provide some type reference (2nd argument or ${opts.optsVarName}.schema).\n\nDebug info:\n
|
|
139
156
|
obj = ${JSON.stringify(obj, null, 4)}\n
|
|
140
157
|
ref = ${JSON.stringify(ref, null, 4)}\n
|
|
141
158
|
innerObj = ${JSON.stringify(innerObj, null, 4)}\n
|
|
142
159
|
opts = ${JSON.stringify(opts, null, 4)}\n
|
|
143
160
|
current = ${JSON.stringify(current, null, 4)}\n\n`);
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
161
|
+
}
|
|
162
|
+
else if (optsSchemaHasThisPathDefined) {
|
|
163
|
+
const currentKeysSchema = arrayiffy(opts.schema[innerObj.path]).map((el) => `${el}`.toLowerCase());
|
|
164
|
+
objectPath.set(opts.schema, innerObj.path, currentKeysSchema);
|
|
165
|
+
if (!intersection(currentKeysSchema, NAMESFORANYTYPE).length) {
|
|
166
|
+
if ((current !== true &&
|
|
167
|
+
current !== false &&
|
|
168
|
+
!currentKeysSchema.includes(typ(current).toLowerCase())) ||
|
|
169
|
+
((current === true || current === false) &&
|
|
170
|
+
!currentKeysSchema.includes(String(current)) &&
|
|
171
|
+
!currentKeysSchema.includes("boolean"))) {
|
|
172
|
+
if (Array.isArray(current) && opts.acceptArrays) {
|
|
173
|
+
for (let i = 0, len = current.length; i < len; i++) {
|
|
174
|
+
if (!currentKeysSchema.includes(typ(current[i]).toLowerCase())) {
|
|
175
|
+
throw new TypeError(`${opts.msg}: ${opts.optsVarName}.${innerObj.path}.${i}, the ${i}th element (equal to ${JSON.stringify(current[i], null, 0)}) is of a type ${typ(current[i]).toLowerCase()}, but only the following are allowed by the ${opts.optsVarName}.schema: ${currentKeysSchema.join(", ")}`);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
throw new TypeError(`${opts.msg}: ${opts.optsVarName}.${innerObj.path} was customised to ${typ(current) !== "string" ? '"' : ""}${JSON.stringify(current, null, 0)}${typ(current) !== "string" ? '"' : ""} (type: ${typ(current).toLowerCase()}) which is not among the allowed types in schema (which is equal to ${JSON.stringify(currentKeysSchema, null, 0)})`);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
ignoredPathsArr.push(innerObj.path);
|
|
154
186
|
}
|
|
155
|
-
} else {
|
|
156
|
-
throw new TypeError(`${opts.msg}: ${opts.optsVarName}.${innerObj.path} was customised to ${typ(current) !== "string" ? '"' : ""}${JSON.stringify(current, null, 0)}${typ(current) !== "string" ? '"' : ""} (type: ${typ(current).toLowerCase()}) which is not among the allowed types in schema (which is equal to ${JSON.stringify(currentKeysSchema, null, 0)})`);
|
|
157
|
-
}
|
|
158
187
|
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
188
|
+
else if (ref && isObj(ref) && refHasThisPathDefined) {
|
|
189
|
+
const compareTo = objectPath.get(ref, innerObj.path);
|
|
190
|
+
if (opts.acceptArrays &&
|
|
191
|
+
Array.isArray(current) &&
|
|
192
|
+
!opts.acceptArraysIgnore.includes(key)) {
|
|
193
|
+
const allMatch = current.every((el) => typ(el).toLowerCase() === typ(ref[key]).toLowerCase());
|
|
194
|
+
if (!allMatch) {
|
|
195
|
+
throw new TypeError(`${opts.msg}: ${opts.optsVarName}.${innerObj.path} was customised to be array, but not all of its elements are ${typ(ref[key]).toLowerCase()}-type`);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
else if (typ(current) !== typ(compareTo)) {
|
|
199
|
+
throw new TypeError(`${opts.msg}: ${opts.optsVarName}.${innerObj.path} was customised to ${typ(current).toLowerCase() === "string" ? "" : '"'}${JSON.stringify(current, null, 0)}${typ(current).toLowerCase() === "string" ? "" : '"'} which is not ${typ(compareTo).toLowerCase()} but ${typ(current).toLowerCase()}`);
|
|
200
|
+
}
|
|
168
201
|
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
} else ;
|
|
173
|
-
return current;
|
|
174
|
-
});
|
|
202
|
+
else ;
|
|
203
|
+
return current;
|
|
204
|
+
});
|
|
175
205
|
}
|
|
176
206
|
function checkTypesMini(obj, ref, originalOptions) {
|
|
177
|
-
|
|
207
|
+
return internalApi(obj, ref, originalOptions);
|
|
178
208
|
}
|
|
179
209
|
|
|
180
210
|
export { checkTypesMini };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @name check-types-mini
|
|
3
3
|
* @fileoverview Validate options object
|
|
4
|
-
* @version 7.0.
|
|
4
|
+
* @version 7.0.6
|
|
5
5
|
* @author Roy Revelt, Codsen Ltd
|
|
6
6
|
* @license MIT
|
|
7
7
|
* {@link https://codsen.com/os/check-types-mini/}
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
/**
|
|
12
12
|
* @name ast-monkey-util
|
|
13
13
|
* @fileoverview Utility library of AST helper functions
|
|
14
|
-
* @version 2.0.
|
|
14
|
+
* @version 2.0.6
|
|
15
15
|
* @author Roy Revelt, Codsen Ltd
|
|
16
16
|
* @license MIT
|
|
17
17
|
* {@link https://codsen.com/os/ast-monkey-util/}
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
/**
|
|
20
20
|
* @name ast-monkey-traverse
|
|
21
21
|
* @fileoverview Utility library to traverse AST
|
|
22
|
-
* @version 3.0.
|
|
22
|
+
* @version 3.0.6
|
|
23
23
|
* @author Roy Revelt, Codsen Ltd
|
|
24
24
|
* @license MIT
|
|
25
25
|
* {@link https://codsen.com/os/ast-monkey-traverse/}
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
/**
|
|
28
28
|
* @name arrayiffy-if-string
|
|
29
29
|
* @fileoverview Put non-empty strings into arrays, turn empty-ones into empty arrays. Bypass everything else.
|
|
30
|
-
* @version 4.0.
|
|
30
|
+
* @version 4.0.6
|
|
31
31
|
* @author Roy Revelt, Codsen Ltd
|
|
32
32
|
* @license MIT
|
|
33
33
|
* {@link https://codsen.com/os/arrayiffy-if-string/}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "check-types-mini",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.6",
|
|
4
4
|
"description": "Validate options object",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"compare",
|
|
@@ -36,13 +36,12 @@
|
|
|
36
36
|
"types": "types/index.d.ts",
|
|
37
37
|
"scripts": {
|
|
38
38
|
"build": "rollup -c",
|
|
39
|
-
"
|
|
40
|
-
"
|
|
39
|
+
"build:esbuild": "node '../../scripts/esbuild.js'",
|
|
40
|
+
"build:esbuild:dev": "cross-env MODE=dev node '../../scripts/esbuild.js'",
|
|
41
|
+
"ci_test": "npm run build && npm run format && tap --no-only --reporter=silent",
|
|
41
42
|
"clean_types": "../../scripts/cleanTypes.js",
|
|
42
43
|
"dev": "rollup -c --dev",
|
|
43
44
|
"devunittest": "npm run dev && tap --only -R 'base'",
|
|
44
|
-
"esbuild": "node '../../scripts/esbuild.js'",
|
|
45
|
-
"esbuild_dev": "cross-env MODE=dev node '../../scripts/esbuild.js'",
|
|
46
45
|
"format": "npm run lect && npm run prettier && npm run lint",
|
|
47
46
|
"lect": "lect",
|
|
48
47
|
"lint": "../../node_modules/eslint/bin/eslint.js . --ext .js --ext .ts --fix --config \"../../.eslintrc.json\" --quiet",
|
|
@@ -51,17 +50,14 @@
|
|
|
51
50
|
"republish": "npm publish || :",
|
|
52
51
|
"tap": "tap",
|
|
53
52
|
"pretest": "npm run build",
|
|
54
|
-
"test": "npm run
|
|
53
|
+
"test": "npm run test:ci && npm run perf",
|
|
54
|
+
"test:ci": "npm run unittest && npm run test:examples && npm run format",
|
|
55
55
|
"test:examples": "../../scripts/test-examples.js && npm run lect && npm run prettier",
|
|
56
56
|
"tsc": "tsc",
|
|
57
|
-
"unittest": "tap --no-only --
|
|
57
|
+
"unittest": "tap --no-only --reporter=terse && tsc -p tsconfig.json --noEmit"
|
|
58
58
|
},
|
|
59
59
|
"tap": {
|
|
60
60
|
"check-coverage": false,
|
|
61
|
-
"coverage-report": [
|
|
62
|
-
"json-summary",
|
|
63
|
-
"text"
|
|
64
|
-
],
|
|
65
61
|
"node-arg": [
|
|
66
62
|
"--no-warnings",
|
|
67
63
|
"--experimental-loader",
|
|
@@ -84,9 +80,9 @@
|
|
|
84
80
|
}
|
|
85
81
|
},
|
|
86
82
|
"dependencies": {
|
|
87
|
-
"@babel/runtime": "^7.16.
|
|
88
|
-
"arrayiffy-if-string": "^4.0.
|
|
89
|
-
"ast-monkey-traverse": "^3.0.
|
|
83
|
+
"@babel/runtime": "^7.16.3",
|
|
84
|
+
"arrayiffy-if-string": "^4.0.6",
|
|
85
|
+
"ast-monkey-traverse": "^3.0.6",
|
|
90
86
|
"lodash.intersection": "^4.4.0",
|
|
91
87
|
"lodash.pullall": "^4.2.0",
|
|
92
88
|
"matcher": "^5.0.0",
|
|
@@ -102,8 +98,8 @@
|
|
|
102
98
|
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.0",
|
|
103
99
|
"@babel/plugin-proposal-object-rest-spread": "^7.16.0",
|
|
104
100
|
"@babel/plugin-proposal-optional-chaining": "^7.16.0",
|
|
105
|
-
"@babel/plugin-transform-runtime": "^7.16.
|
|
106
|
-
"@babel/preset-env": "^7.16.
|
|
101
|
+
"@babel/plugin-transform-runtime": "^7.16.4",
|
|
102
|
+
"@babel/preset-env": "^7.16.4",
|
|
107
103
|
"@babel/preset-typescript": "^7.16.0",
|
|
108
104
|
"@babel/register": "^7.16.0",
|
|
109
105
|
"@istanbuljs/esm-loader-hook": "^0.1.2",
|
|
@@ -114,25 +110,25 @@
|
|
|
114
110
|
"@rollup/plugin-typescript": "^8.3.0",
|
|
115
111
|
"@types/lodash.intersection": "^4.4.6",
|
|
116
112
|
"@types/lodash.pullall": "^4.2.6",
|
|
117
|
-
"@types/node": "^16.11.
|
|
113
|
+
"@types/node": "^16.11.9",
|
|
118
114
|
"@types/tap": "^15.0.5",
|
|
119
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
120
|
-
"@typescript-eslint/parser": "^5.
|
|
115
|
+
"@typescript-eslint/eslint-plugin": "^5.4.0",
|
|
116
|
+
"@typescript-eslint/parser": "^5.4.0",
|
|
121
117
|
"core-js": "^3.19.1",
|
|
122
118
|
"cross-env": "^7.0.3",
|
|
123
|
-
"eslint": "^8.
|
|
124
|
-
"lect": "^0.18.
|
|
125
|
-
"rollup": "^2.
|
|
119
|
+
"eslint": "^8.3.0",
|
|
120
|
+
"lect": "^0.18.6",
|
|
121
|
+
"rollup": "^2.60.0",
|
|
126
122
|
"rollup-plugin-ascii": "^0.0.3",
|
|
127
123
|
"rollup-plugin-banner": "^0.2.1",
|
|
128
124
|
"rollup-plugin-cleanup": "^3.2.1",
|
|
129
125
|
"rollup-plugin-dts": "^4.0.1",
|
|
130
126
|
"rollup-plugin-terser": "^7.0.2",
|
|
131
|
-
"tap": "^15.
|
|
127
|
+
"tap": "^15.1.2",
|
|
132
128
|
"tslib": "^2.3.1",
|
|
133
|
-
"typescript": "^4.
|
|
129
|
+
"typescript": "^4.5.2"
|
|
134
130
|
},
|
|
135
131
|
"engines": {
|
|
136
|
-
"node": ">=
|
|
132
|
+
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
|
137
133
|
}
|
|
138
134
|
}
|