check-types-mini 7.0.4 → 7.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +0 -20
- package/LICENSE +1 -1
- package/README.md +4 -1
- package/dist/check-types-mini.esm.js +14 -170
- package/dist/check-types-mini.umd.js +28 -14
- package/examples/_quickTake.js +1 -0
- package/package.json +24 -81
- package/types/index.d.ts +0 -0
- package/examples/api.json +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,26 +3,6 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
## 7.0.3 (2021-11-02)
|
|
7
|
-
|
|
8
|
-
### Bug Fixes
|
|
9
|
-
|
|
10
|
-
- bump TS and separate ESLint plugins away from this monorepo ([b1ebce1](https://github.com/codsen/codsen/commit/b1ebce1637d8c41c2d848fc24b0ba4058865bd5d))
|
|
11
|
-
|
|
12
|
-
### Features
|
|
13
|
-
|
|
14
|
-
- migrate to ES Modules ([c579dff](https://github.com/codsen/codsen/commit/c579dff3b23205e383035ca10ddcec671e35d0fe))
|
|
15
|
-
|
|
16
|
-
### BREAKING CHANGES
|
|
17
|
-
|
|
18
|
-
- programs now are in ES Modules and won't work with Common JS require()
|
|
19
|
-
|
|
20
|
-
## 7.0.1 (2021-09-13)
|
|
21
|
-
|
|
22
|
-
### Bug Fixes
|
|
23
|
-
|
|
24
|
-
- bump TS and separate ESLint plugins away from this monorepo ([2e07d42](https://github.com/codsen/codsen/commit/2e07d424222b6ffedf5fb45c83ad453627ec2904))
|
|
25
|
-
|
|
26
6
|
## 7.0.0 (2021-09-09)
|
|
27
7
|
|
|
28
8
|
### Features
|
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2010
|
|
3
|
+
Copyright (c) 2010-2021 Roy Revelt and other contributors
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
6
|
a copy of this software and associated documentation files (the
|
package/README.md
CHANGED
|
@@ -38,6 +38,7 @@ If you need a legacy version which works with `require`, use version 6.1.0
|
|
|
38
38
|
|
|
39
39
|
```js
|
|
40
40
|
import { strict as assert } from "assert";
|
|
41
|
+
|
|
41
42
|
import { checkTypesMini } from "check-types-mini";
|
|
42
43
|
|
|
43
44
|
assert.throws(() => {
|
|
@@ -63,7 +64,7 @@ assert.throws(() => {
|
|
|
63
64
|
|
|
64
65
|
## Documentation
|
|
65
66
|
|
|
66
|
-
Please [visit codsen.com](https://codsen.com/os/check-types-mini/) for a full description of the API
|
|
67
|
+
Please [visit codsen.com](https://codsen.com/os/check-types-mini/) for a full description of the API.
|
|
67
68
|
|
|
68
69
|
## Contributing
|
|
69
70
|
|
|
@@ -75,4 +76,6 @@ MIT License
|
|
|
75
76
|
|
|
76
77
|
Copyright (c) 2010-2021 Roy Revelt and other contributors
|
|
77
78
|
|
|
79
|
+
|
|
78
80
|
<img src="https://codsen.com/images/png-codsen-ok.png" width="98" alt="ok" align="center"> <img src="https://codsen.com/images/png-codsen-1.png" width="148" alt="codsen" align="center"> <img src="https://codsen.com/images/png-codsen-star-small.png" width="32" alt="star" align="center">
|
|
81
|
+
|
|
@@ -1,180 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @name check-types-mini
|
|
3
3
|
* @fileoverview Validate options object
|
|
4
|
-
* @version 7.0.
|
|
4
|
+
* @version 7.0.10
|
|
5
5
|
* @author Roy Revelt, Codsen Ltd
|
|
6
6
|
* @license MIT
|
|
7
7
|
* {@link https://codsen.com/os/check-types-mini/}
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import
|
|
11
|
-
import pullAll from 'lodash.pullall';
|
|
12
|
-
import { traverse } from 'ast-monkey-traverse';
|
|
13
|
-
import intersection from 'lodash.intersection';
|
|
14
|
-
import { arrayiffy } from 'arrayiffy-if-string';
|
|
15
|
-
import objectPath from 'object-path';
|
|
16
|
-
import { isMatch } from 'matcher';
|
|
10
|
+
import a from"type-detect";import g from"lodash.pullall";import{traverse as V}from"ast-monkey-traverse";import j from"lodash.intersection";import{arrayiffy as A}from"arrayiffy-if-string";import S from"object-path";import{isMatch as N}from"matcher";var d={ignoreKeys:[],ignorePaths:[],acceptArrays:!1,acceptArraysIgnore:[],enforceStrictKeyset:!0,schema:{},msg:"check-types-mini",optsVarName:"opts"};function T(i,r,y){function b(s){return s!=null}function $(s){return a(s)==="Object"}function p(s,l){return typeof l=="string"&&(l=A(l)),Array.from(s).filter(n=>!l.some(t=>N(n,t,{caseSensitive:!0})))}let D=Object.prototype.hasOwnProperty,w=["any","anything","every","everything","all","whatever","whatevs"];if(!b(i))throw new Error("check-types-mini: [THROW_ID_01] First argument is missing!");let e={...d,...y};if(typeof e.ignoreKeys=="string"&&(e.ignoreKeys=[e.ignoreKeys]),typeof e.ignorePaths=="string"&&(e.ignorePaths=[e.ignorePaths]),typeof e.acceptArraysIgnore=="string"&&(e.acceptArraysIgnore=[e.acceptArraysIgnore]),e.msg=`${e.msg}`.trim(),e.msg[e.msg.length-1]===":"&&(e.msg=e.msg.slice(0,e.msg.length-1).trim()),$(e.schema))Object.keys(e.schema).forEach(s=>{if($(e.schema[s])){let l={};V(e.schema[s],(n,t,h)=>{let m=t!==void 0?t:n;return!Array.isArray(m)&&!$(m)&&(l[`${s}.${h.path}`]=m),m}),delete e.schema[s],e.schema={...e.schema,...l}}}),Object.keys(e.schema).forEach(s=>{Array.isArray(e.schema[s])||(e.schema[s]=[e.schema[s]]),e.schema[s]=e.schema[s].map(l=>`${l}`.toLowerCase().trim())});else if(e.schema!=null)throw new Error(`check-types-mini: opts.schema was customised to ${JSON.stringify(e.schema,null,0)} which is not object but ${typeof e.schema}`);if(b(r)||(r={}),e.enforceStrictKeyset)if(b(e.schema)&&Object.keys(e.schema).length>0){if(r&&p(g(Object.keys(i),Object.keys(r).concat(Object.keys(e.schema))),e.ignoreKeys).length){let s=g(Object.keys(i),Object.keys(r).concat(Object.keys(e.schema)));throw new TypeError(`${e.msg}: ${e.optsVarName}.enforceStrictKeyset is on and the following key${s.length>1?"s":""} ${s.length>1?"are":"is"} not covered by schema and/or reference objects: ${s.join(", ")}`)}}else if($(r)&&Object.keys(r).length>0){if(p(g(Object.keys(i),Object.keys(r)),e.ignoreKeys).length!==0){let s=g(Object.keys(i),Object.keys(r));throw new TypeError(`${e.msg}: The input object has key${s.length>1?"s":""} which ${s.length>1?"are":"is"} not covered by the reference object: ${s.join(", ")}`)}else if(p(g(Object.keys(r),Object.keys(i)),e.ignoreKeys).length!==0){let s=g(Object.keys(r),Object.keys(i));throw new TypeError(`${e.msg}: The reference object has key${s.length>1?"s":""} which ${s.length>1?"are":"is"} not present in the input object: ${s.join(", ")}`)}}else throw new TypeError(`${e.msg}: Both ${e.optsVarName}.schema and reference objects are missing! We don't have anything to match the keys as you requested via opts.enforceStrictKeyset!`);let u=[];V(i,(s,l,n)=>{let t=l,h=s;if(n.parentType==="array"&&(h=void 0,t=s),Array.isArray(u)&&u.length&&u.some(o=>n.path.startsWith(o))||h&&e.ignoreKeys.some(o=>N(h,o))||e.ignorePaths.some(o=>N(n.path,o)))return t;let m=!(!$(t)&&!Array.isArray(t)&&Array.isArray(n.parent)),f=!1;$(e.schema)&&D.call(e.schema,n.path)&&(f=!0);let O=!1;if($(r)&&S.has(r,n.path)&&(O=!0),e.enforceStrictKeyset&&m&&!f&&!O)throw new TypeError(`${e.msg}: ${e.optsVarName}.${n.path} is neither covered by reference object (second input argument), nor ${e.optsVarName}.schema! To stop this error, turn off ${e.optsVarName}.enforceStrictKeyset or provide some type reference (2nd argument or ${e.optsVarName}.schema).
|
|
17
11
|
|
|
18
|
-
|
|
19
|
-
ignoreKeys: [],
|
|
20
|
-
ignorePaths: [],
|
|
21
|
-
acceptArrays: false,
|
|
22
|
-
acceptArraysIgnore: [],
|
|
23
|
-
enforceStrictKeyset: true,
|
|
24
|
-
schema: {},
|
|
25
|
-
msg: "check-types-mini",
|
|
26
|
-
optsVarName: "opts"
|
|
27
|
-
};
|
|
28
|
-
function internalApi(obj, ref, originalOptions) {
|
|
29
|
-
function existy(something) {
|
|
30
|
-
return something != null;
|
|
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);
|
|
38
|
-
}
|
|
39
|
-
return Array.from(originalInput).filter(originalVal => !toBeRemoved.some(remVal => isMatch(originalVal, remVal, {
|
|
40
|
-
caseSensitive: true
|
|
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!`);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
const ignoredPathsArr = [];
|
|
112
|
-
traverse(obj, (key, val, innerObj) => {
|
|
113
|
-
let current = val;
|
|
114
|
-
let objKey = key;
|
|
115
|
-
if (innerObj.parentType === "array") {
|
|
116
|
-
objKey = undefined;
|
|
117
|
-
current = key;
|
|
118
|
-
}
|
|
119
|
-
if (Array.isArray(ignoredPathsArr) && ignoredPathsArr.length && ignoredPathsArr.some(path => innerObj.path.startsWith(path))) {
|
|
120
|
-
return current;
|
|
121
|
-
}
|
|
122
|
-
if (objKey && opts.ignoreKeys.some(oneOfKeysToIgnore => isMatch(objKey, oneOfKeysToIgnore))) {
|
|
123
|
-
return current;
|
|
124
|
-
}
|
|
125
|
-
if (opts.ignorePaths.some(oneOfPathsToIgnore => isMatch(innerObj.path, oneOfPathsToIgnore))) {
|
|
126
|
-
return current;
|
|
127
|
-
}
|
|
128
|
-
const isNotAnArrayChild = !(!isObj(current) && !Array.isArray(current) && Array.isArray(innerObj.parent));
|
|
129
|
-
let optsSchemaHasThisPathDefined = false;
|
|
130
|
-
if (isObj(opts.schema) && hasKey.call(opts.schema, innerObj.path)) {
|
|
131
|
-
optsSchemaHasThisPathDefined = true;
|
|
132
|
-
}
|
|
133
|
-
let refHasThisPathDefined = false;
|
|
134
|
-
if (isObj(ref) && objectPath.has(ref, innerObj.path)) {
|
|
135
|
-
refHasThisPathDefined = true;
|
|
136
|
-
}
|
|
137
|
-
if (opts.enforceStrictKeyset && isNotAnArrayChild && !optsSchemaHasThisPathDefined && !refHasThisPathDefined) {
|
|
138
|
-
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
|
-
obj = ${JSON.stringify(obj, null, 4)}\n
|
|
140
|
-
ref = ${JSON.stringify(ref, null, 4)}\n
|
|
141
|
-
innerObj = ${JSON.stringify(innerObj, null, 4)}\n
|
|
142
|
-
opts = ${JSON.stringify(opts, null, 4)}\n
|
|
143
|
-
current = ${JSON.stringify(current, null, 4)}\n\n`);
|
|
144
|
-
} else if (optsSchemaHasThisPathDefined) {
|
|
145
|
-
const currentKeysSchema = arrayiffy(opts.schema[innerObj.path]).map(el => `${el}`.toLowerCase());
|
|
146
|
-
objectPath.set(opts.schema, innerObj.path, currentKeysSchema);
|
|
147
|
-
if (!intersection(currentKeysSchema, NAMESFORANYTYPE).length) {
|
|
148
|
-
if (current !== true && current !== false && !currentKeysSchema.includes(typ(current).toLowerCase()) || (current === true || current === false) && !currentKeysSchema.includes(String(current)) && !currentKeysSchema.includes("boolean")) {
|
|
149
|
-
if (Array.isArray(current) && opts.acceptArrays) {
|
|
150
|
-
for (let i = 0, len = current.length; i < len; i++) {
|
|
151
|
-
if (!currentKeysSchema.includes(typ(current[i]).toLowerCase())) {
|
|
152
|
-
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(", ")}`);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
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
|
-
}
|
|
159
|
-
} else {
|
|
160
|
-
ignoredPathsArr.push(innerObj.path);
|
|
161
|
-
}
|
|
162
|
-
} else if (ref && isObj(ref) && refHasThisPathDefined) {
|
|
163
|
-
const compareTo = objectPath.get(ref, innerObj.path);
|
|
164
|
-
if (opts.acceptArrays && Array.isArray(current) && !opts.acceptArraysIgnore.includes(key)) {
|
|
165
|
-
const allMatch = current.every(el => typ(el).toLowerCase() === typ(ref[key]).toLowerCase());
|
|
166
|
-
if (!allMatch) {
|
|
167
|
-
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`);
|
|
168
|
-
}
|
|
169
|
-
} else if (typ(current) !== typ(compareTo)) {
|
|
170
|
-
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()}`);
|
|
171
|
-
}
|
|
172
|
-
} else ;
|
|
173
|
-
return current;
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
function checkTypesMini(obj, ref, originalOptions) {
|
|
177
|
-
return internalApi(obj, ref, originalOptions);
|
|
178
|
-
}
|
|
12
|
+
Debug info:
|
|
179
13
|
|
|
180
|
-
|
|
14
|
+
obj = ${JSON.stringify(i,null,4)}
|
|
15
|
+
|
|
16
|
+
ref = ${JSON.stringify(r,null,4)}
|
|
17
|
+
|
|
18
|
+
innerObj = ${JSON.stringify(n,null,4)}
|
|
19
|
+
|
|
20
|
+
opts = ${JSON.stringify(e,null,4)}
|
|
21
|
+
|
|
22
|
+
current = ${JSON.stringify(t,null,4)}
|
|
23
|
+
|
|
24
|
+
`);if(f){let o=A(e.schema[n.path]).map(c=>`${c}`.toLowerCase());if(S.set(e.schema,n.path,o),j(o,w).length)u.push(n.path);else if(t!==!0&&t!==!1&&!o.includes(a(t).toLowerCase())||(t===!0||t===!1)&&!o.includes(String(t))&&!o.includes("boolean"))if(Array.isArray(t)&&e.acceptArrays){for(let c=0,E=t.length;c<E;c++)if(!o.includes(a(t[c]).toLowerCase()))throw new TypeError(`${e.msg}: ${e.optsVarName}.${n.path}.${c}, the ${c}th element (equal to ${JSON.stringify(t[c],null,0)}) is of a type ${a(t[c]).toLowerCase()}, but only the following are allowed by the ${e.optsVarName}.schema: ${o.join(", ")}`)}else throw new TypeError(`${e.msg}: ${e.optsVarName}.${n.path} was customised to ${a(t)!=="string"?'"':""}${JSON.stringify(t,null,0)}${a(t)!=="string"?'"':""} (type: ${a(t).toLowerCase()}) which is not among the allowed types in schema (which is equal to ${JSON.stringify(o,null,0)})`)}else if(r&&$(r)&&O){let o=S.get(r,n.path);if(e.acceptArrays&&Array.isArray(t)&&!e.acceptArraysIgnore.includes(s)){if(!t.every(E=>a(E).toLowerCase()===a(r[s]).toLowerCase()))throw new TypeError(`${e.msg}: ${e.optsVarName}.${n.path} was customised to be array, but not all of its elements are ${a(r[s]).toLowerCase()}-type`)}else if(a(t)!==a(o))throw new TypeError(`${e.msg}: ${e.optsVarName}.${n.path} was customised to ${a(t).toLowerCase()==="string"?"":'"'}${JSON.stringify(t,null,0)}${a(t).toLowerCase()==="string"?"":'"'} which is not ${a(o).toLowerCase()} but ${a(t).toLowerCase()}`)}return t})}function H(i,r,y){T(i,r,y)}export{H as checkTypesMini};
|
|
@@ -1,34 +1,48 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @name check-types-mini
|
|
3
3
|
* @fileoverview Validate options object
|
|
4
|
-
* @version 7.0.
|
|
4
|
+
* @version 7.0.10
|
|
5
5
|
* @author Roy Revelt, Codsen Ltd
|
|
6
6
|
* @license MIT
|
|
7
7
|
* {@link https://codsen.com/os/check-types-mini/}
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).checkTypesMini={})}(this,(function(t){"use strict";var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},r={exports:{}};!function(t,r){t.exports=function(){var t="function"==typeof Promise,r="object"==typeof self?self:e,n="undefined"!=typeof Symbol,o="undefined"!=typeof Map,i="undefined"!=typeof Set,a="undefined"!=typeof WeakMap,c="undefined"!=typeof WeakSet,u="undefined"!=typeof DataView,s=n&&void 0!==Symbol.iterator,f=n&&void 0!==Symbol.toStringTag,p=i&&"function"==typeof Set.prototype.entries,l=o&&"function"==typeof Map.prototype.entries,y=p&&Object.getPrototypeOf((new Set).entries()),h=l&&Object.getPrototypeOf((new Map).entries()),g=s&&"function"==typeof Array.prototype[Symbol.iterator],d=g&&Object.getPrototypeOf([][Symbol.iterator]()),b=s&&"function"==typeof String.prototype[Symbol.iterator],v=b&&Object.getPrototypeOf(""[Symbol.iterator]()),_=8,m=-1;function w(e){var n=typeof e;if("object"!==n)return n;if(null===e)return"null";if(e===r)return"global";if(Array.isArray(e)&&(!1===f||!(Symbol.toStringTag in e)))return"Array";if("object"==typeof window&&null!==window){if("object"==typeof window.location&&e===window.location)return"Location";if("object"==typeof window.document&&e===window.document)return"Document";if("object"==typeof window.navigator){if("object"==typeof window.navigator.mimeTypes&&e===window.navigator.mimeTypes)return"MimeTypeArray";if("object"==typeof window.navigator.plugins&&e===window.navigator.plugins)return"PluginArray"}if(("function"==typeof window.HTMLElement||"object"==typeof window.HTMLElement)&&e instanceof window.HTMLElement){if("BLOCKQUOTE"===e.tagName)return"HTMLQuoteElement";if("TD"===e.tagName)return"HTMLTableDataCellElement";if("TH"===e.tagName)return"HTMLTableHeaderCellElement"}}var s=f&&e[Symbol.toStringTag];if("string"==typeof s)return s;var p=Object.getPrototypeOf(e);return p===RegExp.prototype?"RegExp":p===Date.prototype?"Date":t&&p===Promise.prototype?"Promise":i&&p===Set.prototype?"Set":o&&p===Map.prototype?"Map":c&&p===WeakSet.prototype?"WeakSet":a&&p===WeakMap.prototype?"WeakMap":u&&p===DataView.prototype?"DataView":o&&p===h?"Map Iterator":i&&p===y?"Set Iterator":g&&p===d?"Array Iterator":b&&p===v?"String Iterator":null===p?"Object":Object.prototype.toString.call(e).slice(_,m)}return w}()}(r);var n=r.exports;function o(t,e,r){if(e!=e)return function(t,e,r,n){for(var o=t.length,i=r+(n?1:-1);n?i--:++i<o;)if(e(t[i],i,t))return i;return-1}(t,a,r);for(var n=r-1,o=t.length;++n<o;)if(t[n]===e)return n;return-1}function i(t,e,r,n){for(var o=r-1,i=t.length;++o<i;)if(n(t[o],e))return o;return-1}function a(t){return t!=t}var c=Array.prototype.splice;function u(t,e,r,n){var a,u=n?i:o,s=-1,f=e.length,p=t;for(t===e&&(e=function(t,e){var r=-1,n=t.length;e||(e=Array(n));for(;++r<n;)e[r]=t[r];return e}(e)),r&&(p=function(t,e){for(var r=-1,n=t?t.length:0,o=Array(n);++r<n;)o[r]=e(t[r],r,t);return o}(t,(a=r,function(t){return a(t)})));++s<f;)for(var l=0,y=e[s],h=r?r(y):y;(l=u(p,h,l,n))>-1;)p!==t&&c.call(p,l,1),c.call(t,l,1);return t}var s=function(t,e){return t&&t.length&&e&&e.length?u(t,e):t},f={exports:{}};!function(t,r){var n="__lodash_hash_undefined__",o=9007199254740991,i="[object Arguments]",a="[object Boolean]",c="[object Date]",u="[object Function]",s="[object GeneratorFunction]",f="[object Map]",p="[object Number]",l="[object Object]",y="[object Promise]",h="[object RegExp]",g="[object Set]",d="[object String]",b="[object Symbol]",v="[object WeakMap]",_="[object ArrayBuffer]",m="[object DataView]",w="[object Float32Array]",j="[object Float64Array]",O="[object Int8Array]",$="[object Int16Array]",A="[object Int32Array]",S="[object Uint8Array]",k="[object Uint8ClampedArray]",T="[object Uint16Array]",E="[object Uint32Array]",x=/\w*$/,P=/^\[object .+?Constructor\]$/,N=/^(?:0|[1-9]\d*)$/,M={};M[i]=M["[object Array]"]=M[_]=M[m]=M[a]=M[c]=M[w]=M[j]=M[O]=M[$]=M[A]=M[f]=M[p]=M[l]=M[h]=M[g]=M[d]=M[b]=M[S]=M[k]=M[T]=M[E]=!0,M["[object Error]"]=M[u]=M[v]=!1;var I="object"==typeof self&&self&&self.Object===Object&&self,L="object"==typeof e&&e&&e.Object===Object&&e||I||Function("return this")(),C=r&&!r.nodeType&&r,K=C&&t&&!t.nodeType&&t,V=K&&K.exports===C;function D(t,e){return t.set(e[0],e[1]),t}function F(t,e){return t.add(e),t}function J(t,e,r,n){var o=-1,i=t?t.length:0;for(n&&i&&(r=t[++o]);++o<i;)r=e(r,t[o],o,t);return r}function W(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}function H(t){var e=-1,r=Array(t.size);return t.forEach((function(t,n){r[++e]=[n,t]})),r}function R(t,e){return function(r){return t(e(r))}}function B(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r}var U,q=Array.prototype,z=Function.prototype,G=Object.prototype,Q=L["__core-js_shared__"],X=(U=/[^.]+$/.exec(Q&&Q.keys&&Q.keys.IE_PROTO||""))?"Symbol(src)_1."+U:"",Y=z.toString,Z=G.hasOwnProperty,tt=G.toString,et=RegExp("^"+Y.call(Z).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),rt=V?L.Buffer:void 0,nt=L.Symbol,ot=L.Uint8Array,it=R(Object.getPrototypeOf,Object),at=Object.create,ct=G.propertyIsEnumerable,ut=q.splice,st=Object.getOwnPropertySymbols,ft=rt?rt.isBuffer:void 0,pt=R(Object.keys,Object),lt=Kt(L,"DataView"),yt=Kt(L,"Map"),ht=Kt(L,"Promise"),gt=Kt(L,"Set"),dt=Kt(L,"WeakMap"),bt=Kt(Object,"create"),vt=Wt(lt),_t=Wt(yt),mt=Wt(ht),wt=Wt(gt),jt=Wt(dt),Ot=nt?nt.prototype:void 0,$t=Ot?Ot.valueOf:void 0;function At(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function St(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function kt(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function Tt(t){this.__data__=new St(t)}function Et(t,e){var r=Rt(t)||function(t){return function(t){return function(t){return!!t&&"object"==typeof t}(t)&&Bt(t)}(t)&&Z.call(t,"callee")&&(!ct.call(t,"callee")||tt.call(t)==i)}(t)?function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}(t.length,String):[],n=r.length,o=!!n;for(var a in t)!e&&!Z.call(t,a)||o&&("length"==a||Ft(a,n))||r.push(a);return r}function xt(t,e,r){var n=t[e];Z.call(t,e)&&Ht(n,r)&&(void 0!==r||e in t)||(t[e]=r)}function Pt(t,e){for(var r=t.length;r--;)if(Ht(t[r][0],e))return r;return-1}function Nt(t,e,r,n,o,y,v){var P;if(n&&(P=y?n(t,o,y,v):n(t)),void 0!==P)return P;if(!zt(t))return t;var N=Rt(t);if(N){if(P=function(t){var e=t.length,r=t.constructor(e);e&&"string"==typeof t[0]&&Z.call(t,"index")&&(r.index=t.index,r.input=t.input);return r}(t),!e)return function(t,e){var r=-1,n=t.length;e||(e=Array(n));for(;++r<n;)e[r]=t[r];return e}(t,P)}else{var I=Dt(t),L=I==u||I==s;if(Ut(t))return function(t,e){if(e)return t.slice();var r=new t.constructor(t.length);return t.copy(r),r}(t,e);if(I==l||I==i||L&&!y){if(W(t))return y?t:{};if(P=function(t){return"function"!=typeof t.constructor||Jt(t)?{}:(e=it(t),zt(e)?at(e):{});var e}(L?{}:t),!e)return function(t,e){return Lt(t,Vt(t),e)}(t,function(t,e){return t&&Lt(e,Gt(e),t)}(P,t))}else{if(!M[I])return y?t:{};P=function(t,e,r,n){var o=t.constructor;switch(e){case _:return It(t);case a:case c:return new o(+t);case m:return function(t,e){var r=e?It(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}(t,n);case w:case j:case O:case $:case A:case S:case k:case T:case E:return function(t,e){var r=e?It(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}(t,n);case f:return function(t,e,r){return J(e?r(H(t),!0):H(t),D,new t.constructor)}(t,n,r);case p:case d:return new o(t);case h:return function(t){var e=new t.constructor(t.source,x.exec(t));return e.lastIndex=t.lastIndex,e}(t);case g:return function(t,e,r){return J(e?r(B(t),!0):B(t),F,new t.constructor)}(t,n,r);case b:return i=t,$t?Object($t.call(i)):{}}var i}(t,I,Nt,e)}}v||(v=new Tt);var C=v.get(t);if(C)return C;if(v.set(t,P),!N)var K=r?function(t){return function(t,e,r){var n=e(t);return Rt(t)?n:function(t,e){for(var r=-1,n=e.length,o=t.length;++r<n;)t[o+r]=e[r];return t}(n,r(t))}(t,Gt,Vt)}(t):Gt(t);return function(t,e){for(var r=-1,n=t?t.length:0;++r<n&&!1!==e(t[r],r,t););}(K||t,(function(o,i){K&&(o=t[i=o]),xt(P,i,Nt(o,e,r,n,i,t,v))})),P}function Mt(t){return!(!zt(t)||(e=t,X&&X in e))&&(qt(t)||W(t)?et:P).test(Wt(t));var e}function It(t){var e=new t.constructor(t.byteLength);return new ot(e).set(new ot(t)),e}function Lt(t,e,r,n){r||(r={});for(var o=-1,i=e.length;++o<i;){var a=e[o],c=n?n(r[a],t[a],a,r,t):void 0;xt(r,a,void 0===c?t[a]:c)}return r}function Ct(t,e){var r,n,o=t.__data__;return("string"==(n=typeof(r=e))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?o["string"==typeof e?"string":"hash"]:o.map}function Kt(t,e){var r=function(t,e){return null==t?void 0:t[e]}(t,e);return Mt(r)?r:void 0}At.prototype.clear=function(){this.__data__=bt?bt(null):{}},At.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},At.prototype.get=function(t){var e=this.__data__;if(bt){var r=e[t];return r===n?void 0:r}return Z.call(e,t)?e[t]:void 0},At.prototype.has=function(t){var e=this.__data__;return bt?void 0!==e[t]:Z.call(e,t)},At.prototype.set=function(t,e){return this.__data__[t]=bt&&void 0===e?n:e,this},St.prototype.clear=function(){this.__data__=[]},St.prototype.delete=function(t){var e=this.__data__,r=Pt(e,t);return!(r<0)&&(r==e.length-1?e.pop():ut.call(e,r,1),!0)},St.prototype.get=function(t){var e=this.__data__,r=Pt(e,t);return r<0?void 0:e[r][1]},St.prototype.has=function(t){return Pt(this.__data__,t)>-1},St.prototype.set=function(t,e){var r=this.__data__,n=Pt(r,t);return n<0?r.push([t,e]):r[n][1]=e,this},kt.prototype.clear=function(){this.__data__={hash:new At,map:new(yt||St),string:new At}},kt.prototype.delete=function(t){return Ct(this,t).delete(t)},kt.prototype.get=function(t){return Ct(this,t).get(t)},kt.prototype.has=function(t){return Ct(this,t).has(t)},kt.prototype.set=function(t,e){return Ct(this,t).set(t,e),this},Tt.prototype.clear=function(){this.__data__=new St},Tt.prototype.delete=function(t){return this.__data__.delete(t)},Tt.prototype.get=function(t){return this.__data__.get(t)},Tt.prototype.has=function(t){return this.__data__.has(t)},Tt.prototype.set=function(t,e){var r=this.__data__;if(r instanceof St){var n=r.__data__;if(!yt||n.length<199)return n.push([t,e]),this;r=this.__data__=new kt(n)}return r.set(t,e),this};var Vt=st?R(st,Object):function(){return[]},Dt=function(t){return tt.call(t)};function Ft(t,e){return!!(e=null==e?o:e)&&("number"==typeof t||N.test(t))&&t>-1&&t%1==0&&t<e}function Jt(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||G)}function Wt(t){if(null!=t){try{return Y.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function Ht(t,e){return t===e||t!=t&&e!=e}(lt&&Dt(new lt(new ArrayBuffer(1)))!=m||yt&&Dt(new yt)!=f||ht&&Dt(ht.resolve())!=y||gt&&Dt(new gt)!=g||dt&&Dt(new dt)!=v)&&(Dt=function(t){var e=tt.call(t),r=e==l?t.constructor:void 0,n=r?Wt(r):void 0;if(n)switch(n){case vt:return m;case _t:return f;case mt:return y;case wt:return g;case jt:return v}return e});var Rt=Array.isArray;function Bt(t){return null!=t&&function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=o}(t.length)&&!qt(t)}var Ut=ft||function(){return!1};function qt(t){var e=zt(t)?tt.call(t):"";return e==u||e==s}function zt(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function Gt(t){return Bt(t)?Et(t):function(t){if(!Jt(t))return pt(t);var e=[];for(var r in Object(t))Z.call(t,r)&&"constructor"!=r&&e.push(r);return e}(t)}t.exports=function(t){return Nt(t,!0,!0)}}(f,f.exports);var p=f.exports;var l,y,h=Object.prototype,g=Function.prototype.toString,d=h.hasOwnProperty,b=g.call(Object),v=h.toString,_=(l=Object.getPrototypeOf,y=Object,function(t){return l(y(t))});var m=function(t){if(!function(t){return!!t&&"object"==typeof t}(t)||"[object Object]"!=v.call(t)||function(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}(t))return!1;var e=_(t);if(null===e)return!0;var r=d.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&g.call(r)==b};
|
|
10
|
+
var checkTypesMini=(()=>{var zt=Object.create;var F=Object.defineProperty,en=Object.defineProperties,tn=Object.getOwnPropertyDescriptor,nn=Object.getOwnPropertyDescriptors,rn=Object.getOwnPropertyNames,Ve=Object.getOwnPropertySymbols,on=Object.getPrototypeOf,Me=Object.prototype.hasOwnProperty,sn=Object.prototype.propertyIsEnumerable;var Le=(e,t,n)=>t in e?F(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,E=(e,t)=>{for(var n in t||(t={}))Me.call(t,n)&&Le(e,n,t[n]);if(Ve)for(var n of Ve(t))sn.call(t,n)&&Le(e,n,t[n]);return e},R=(e,t)=>en(e,nn(t)),Ke=e=>F(e,"__esModule",{value:!0});var D=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),an=(e,t)=>{for(var n in t)F(e,n,{get:t[n],enumerable:!0})},He=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let c of rn(t))!Me.call(e,c)&&(n||c!=="default")&&F(e,c,{get:()=>t[c],enumerable:!(r=tn(t,c))||r.enumerable});return e},V=(e,t)=>He(Ke(F(e!=null?zt(on(e)):{},"default",!t&&e&&e.__esModule?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e),cn=(e=>(t,n)=>e&&e.get(t)||(n=He(Ke({}),t,1),e&&e.set(t,n),n))(typeof WeakMap!="undefined"?new WeakMap:0);var Je=D((ue,le)=>{(function(e,t){typeof ue=="object"&&typeof le!="undefined"?le.exports=t():typeof define=="function"&&define.amd?define(t):e.typeDetect=t()})(ue,function(){"use strict";var e=typeof Promise=="function",t=typeof self=="object"?self:global,n=typeof Symbol!="undefined",r=typeof Map!="undefined",c=typeof Set!="undefined",l=typeof WeakMap!="undefined",d=typeof WeakSet!="undefined",g=typeof DataView!="undefined",i=n&&typeof Symbol.iterator!="undefined",m=n&&typeof Symbol.toStringTag!="undefined",o=c&&typeof Set.prototype.entries=="function",a=r&&typeof Map.prototype.entries=="function",y=o&&Object.getPrototypeOf(new Set().entries()),h=a&&Object.getPrototypeOf(new Map().entries()),$=i&&typeof Array.prototype[Symbol.iterator]=="function",S=$&&Object.getPrototypeOf([][Symbol.iterator]()),f=i&&typeof String.prototype[Symbol.iterator]=="function",s=f&&Object.getPrototypeOf(""[Symbol.iterator]()),u=8,p=-1;function w(O){var Ie=typeof O;if(Ie!=="object")return Ie;if(O===null)return"null";if(O===t)return"global";if(Array.isArray(O)&&(m===!1||!(Symbol.toStringTag in O)))return"Array";if(typeof window=="object"&&window!==null){if(typeof window.location=="object"&&O===window.location)return"Location";if(typeof window.document=="object"&&O===window.document)return"Document";if(typeof window.navigator=="object"){if(typeof window.navigator.mimeTypes=="object"&&O===window.navigator.mimeTypes)return"MimeTypeArray";if(typeof window.navigator.plugins=="object"&&O===window.navigator.plugins)return"PluginArray"}if((typeof window.HTMLElement=="function"||typeof window.HTMLElement=="object")&&O instanceof window.HTMLElement){if(O.tagName==="BLOCKQUOTE")return"HTMLQuoteElement";if(O.tagName==="TD")return"HTMLTableDataCellElement";if(O.tagName==="TH")return"HTMLTableHeaderCellElement"}}var De=m&&O[Symbol.toStringTag];if(typeof De=="string")return De;var v=Object.getPrototypeOf(O);return v===RegExp.prototype?"RegExp":v===Date.prototype?"Date":e&&v===Promise.prototype?"Promise":c&&v===Set.prototype?"Set":r&&v===Map.prototype?"Map":d&&v===WeakSet.prototype?"WeakSet":l&&v===WeakMap.prototype?"WeakMap":g&&v===DataView.prototype?"DataView":r&&v===h?"Map Iterator":c&&v===y?"Set Iterator":$&&v===S?"Array Iterator":f&&v===s?"String Iterator":v===null?"Object":Object.prototype.toString.call(O).slice(u,p)}return w})});var Re=D((uo,Fe)=>{function un(e,t){for(var n=-1,r=e?e.length:0,c=Array(r);++n<r;)c[n]=t(e[n],n,e);return c}function ln(e,t,n,r){for(var c=e.length,l=n+(r?1:-1);r?l--:++l<c;)if(t(e[l],l,e))return l;return-1}function fn(e,t,n){if(t!==t)return ln(e,gn,n);for(var r=n-1,c=e.length;++r<c;)if(e[r]===t)return r;return-1}function hn(e,t,n,r){for(var c=n-1,l=e.length;++c<l;)if(r(e[c],t))return c;return-1}function gn(e){return e!==e}function pn(e){return function(t){return e(t)}}var yn=Array.prototype,ke=yn.splice;function dn(e,t,n,r){var c=r?hn:fn,l=-1,d=t.length,g=e;for(e===t&&(t=mn(t)),n&&(g=un(e,pn(n)));++l<d;)for(var i=0,m=t[l],o=n?n(m):m;(i=c(g,o,i,r))>-1;)g!==e&&ke.call(g,i,1),ke.call(e,i,1);return e}function mn(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}function bn(e,t){return e&&e.length&&t&&t.length?dn(e,t):e}Fe.exports=bn});var Nt=D((W,H)=>{var $n=200,Ge="__lodash_hash_undefined__",Ue=9007199254740991,fe="[object Arguments]",wn="[object Array]",We="[object Boolean]",Be="[object Date]",On="[object Error]",he="[object Function]",Ye="[object GeneratorFunction]",Y="[object Map]",qe="[object Number]",ge="[object Object]",Qe="[object Promise]",Xe="[object RegExp]",q="[object Set]",Ze="[object String]",ze="[object Symbol]",pe="[object WeakMap]",et="[object ArrayBuffer]",Q="[object DataView]",tt="[object Float32Array]",nt="[object Float64Array]",rt="[object Int8Array]",it="[object Int16Array]",ot="[object Int32Array]",st="[object Uint8Array]",at="[object Uint8ClampedArray]",ct="[object Uint16Array]",ut="[object Uint32Array]",_n=/[\\^$.*+?()[\]{}|]/g,Sn=/\w*$/,vn=/^\[object .+?Constructor\]$/,En=/^(?:0|[1-9]\d*)$/,b={};b[fe]=b[wn]=b[et]=b[Q]=b[We]=b[Be]=b[tt]=b[nt]=b[rt]=b[it]=b[ot]=b[Y]=b[qe]=b[ge]=b[Xe]=b[q]=b[Ze]=b[ze]=b[st]=b[at]=b[ct]=b[ut]=!0;b[On]=b[he]=b[pe]=!1;var An=typeof global=="object"&&global&&global.Object===Object&&global,Tn=typeof self=="object"&&self&&self.Object===Object&&self,A=An||Tn||Function("return this")(),lt=typeof W=="object"&&W&&!W.nodeType&&W,ft=lt&&typeof H=="object"&&H&&!H.nodeType&&H,xn=ft&&ft.exports===lt;function jn(e,t){return e.set(t[0],t[1]),e}function Pn(e,t){return e.add(t),e}function Nn(e,t){for(var n=-1,r=e?e.length:0;++n<r&&t(e[n],n,e)!==!1;);return e}function Cn(e,t){for(var n=-1,r=t.length,c=e.length;++n<r;)e[c+n]=t[n];return e}function ht(e,t,n,r){var c=-1,l=e?e.length:0;for(r&&l&&(n=e[++c]);++c<l;)n=t(n,e[c],c,e);return n}function In(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function Dn(e,t){return e==null?void 0:e[t]}function gt(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch(n){}return t}function pt(e){var t=-1,n=Array(e.size);return e.forEach(function(r,c){n[++t]=[c,r]}),n}function ye(e,t){return function(n){return e(t(n))}}function yt(e){var t=-1,n=Array(e.size);return e.forEach(function(r){n[++t]=r}),n}var Vn=Array.prototype,Mn=Function.prototype,X=Object.prototype,de=A["__core-js_shared__"],dt=function(){var e=/[^.]+$/.exec(de&&de.keys&&de.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),mt=Mn.toString,x=X.hasOwnProperty,Z=X.toString,Ln=RegExp("^"+mt.call(x).replace(_n,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),bt=xn?A.Buffer:void 0,$t=A.Symbol,wt=A.Uint8Array,Kn=ye(Object.getPrototypeOf,Object),Hn=Object.create,Jn=X.propertyIsEnumerable,kn=Vn.splice,Ot=Object.getOwnPropertySymbols,Fn=bt?bt.isBuffer:void 0,Rn=ye(Object.keys,Object),me=K(A,"DataView"),G=K(A,"Map"),be=K(A,"Promise"),$e=K(A,"Set"),we=K(A,"WeakMap"),U=K(Object,"create"),Gn=N(me),Un=N(G),Wn=N(be),Bn=N($e),Yn=N(we),_t=$t?$t.prototype:void 0,St=_t?_t.valueOf:void 0;function j(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function qn(){this.__data__=U?U(null):{}}function Qn(e){return this.has(e)&&delete this.__data__[e]}function Xn(e){var t=this.__data__;if(U){var n=t[e];return n===Ge?void 0:n}return x.call(t,e)?t[e]:void 0}function Zn(e){var t=this.__data__;return U?t[e]!==void 0:x.call(t,e)}function zn(e,t){var n=this.__data__;return n[e]=U&&t===void 0?Ge:t,this}j.prototype.clear=qn;j.prototype.delete=Qn;j.prototype.get=Xn;j.prototype.has=Zn;j.prototype.set=zn;function T(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function er(){this.__data__=[]}function tr(e){var t=this.__data__,n=z(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():kn.call(t,n,1),!0}function nr(e){var t=this.__data__,n=z(t,e);return n<0?void 0:t[n][1]}function rr(e){return z(this.__data__,e)>-1}function ir(e,t){var n=this.__data__,r=z(n,e);return r<0?n.push([e,t]):n[r][1]=t,this}T.prototype.clear=er;T.prototype.delete=tr;T.prototype.get=nr;T.prototype.has=rr;T.prototype.set=ir;function M(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function or(){this.__data__={hash:new j,map:new(G||T),string:new j}}function sr(e){return ee(this,e).delete(e)}function ar(e){return ee(this,e).get(e)}function cr(e){return ee(this,e).has(e)}function ur(e,t){return ee(this,e).set(e,t),this}M.prototype.clear=or;M.prototype.delete=sr;M.prototype.get=ar;M.prototype.has=cr;M.prototype.set=ur;function L(e){this.__data__=new T(e)}function lr(){this.__data__=new T}function fr(e){return this.__data__.delete(e)}function hr(e){return this.__data__.get(e)}function gr(e){return this.__data__.has(e)}function pr(e,t){var n=this.__data__;if(n instanceof T){var r=n.__data__;if(!G||r.length<$n-1)return r.push([e,t]),this;n=this.__data__=new M(r)}return n.set(e,t),this}L.prototype.clear=lr;L.prototype.delete=fr;L.prototype.get=hr;L.prototype.has=gr;L.prototype.set=pr;function yr(e,t){var n=Se(e)||Hr(e)?In(e.length,String):[],r=n.length,c=!!r;for(var l in e)(t||x.call(e,l))&&!(c&&(l=="length"||Vr(l,r)))&&n.push(l);return n}function vt(e,t,n){var r=e[t];(!(x.call(e,t)&&xt(r,n))||n===void 0&&!(t in e))&&(e[t]=n)}function z(e,t){for(var n=e.length;n--;)if(xt(e[n][0],t))return n;return-1}function dr(e,t){return e&&Et(t,ve(t),e)}function Oe(e,t,n,r,c,l,d){var g;if(r&&(g=l?r(e,c,l,d):r(e)),g!==void 0)return g;if(!te(e))return e;var i=Se(e);if(i){if(g=Cr(e),!t)return jr(e,g)}else{var m=P(e),o=m==he||m==Ye;if(kr(e))return _r(e,t);if(m==ge||m==fe||o&&!l){if(gt(e))return l?e:{};if(g=Ir(o?{}:e),!t)return Pr(e,dr(g,e))}else{if(!b[m])return l?e:{};g=Dr(e,m,Oe,t)}}d||(d=new L);var a=d.get(e);if(a)return a;if(d.set(e,g),!i)var y=n?Nr(e):ve(e);return Nn(y||e,function(h,$){y&&($=h,h=e[$]),vt(g,$,Oe(h,t,n,r,$,e,d))}),g}function mr(e){return te(e)?Hn(e):{}}function br(e,t,n){var r=t(e);return Se(e)?r:Cn(r,n(e))}function $r(e){return Z.call(e)}function wr(e){if(!te(e)||Lr(e))return!1;var t=Pt(e)||gt(e)?Ln:vn;return t.test(N(e))}function Or(e){if(!Tt(e))return Rn(e);var t=[];for(var n in Object(e))x.call(e,n)&&n!="constructor"&&t.push(n);return t}function _r(e,t){if(t)return e.slice();var n=new e.constructor(e.length);return e.copy(n),n}function _e(e){var t=new e.constructor(e.byteLength);return new wt(t).set(new wt(e)),t}function Sr(e,t){var n=t?_e(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}function vr(e,t,n){var r=t?n(pt(e),!0):pt(e);return ht(r,jn,new e.constructor)}function Er(e){var t=new e.constructor(e.source,Sn.exec(e));return t.lastIndex=e.lastIndex,t}function Ar(e,t,n){var r=t?n(yt(e),!0):yt(e);return ht(r,Pn,new e.constructor)}function Tr(e){return St?Object(St.call(e)):{}}function xr(e,t){var n=t?_e(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function jr(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}function Et(e,t,n,r){n||(n={});for(var c=-1,l=t.length;++c<l;){var d=t[c],g=r?r(n[d],e[d],d,n,e):void 0;vt(n,d,g===void 0?e[d]:g)}return n}function Pr(e,t){return Et(e,At(e),t)}function Nr(e){return br(e,ve,At)}function ee(e,t){var n=e.__data__;return Mr(t)?n[typeof t=="string"?"string":"hash"]:n.map}function K(e,t){var n=Dn(e,t);return wr(n)?n:void 0}var At=Ot?ye(Ot,Object):Gr,P=$r;(me&&P(new me(new ArrayBuffer(1)))!=Q||G&&P(new G)!=Y||be&&P(be.resolve())!=Qe||$e&&P(new $e)!=q||we&&P(new we)!=pe)&&(P=function(e){var t=Z.call(e),n=t==ge?e.constructor:void 0,r=n?N(n):void 0;if(r)switch(r){case Gn:return Q;case Un:return Y;case Wn:return Qe;case Bn:return q;case Yn:return pe}return t});function Cr(e){var t=e.length,n=e.constructor(t);return t&&typeof e[0]=="string"&&x.call(e,"index")&&(n.index=e.index,n.input=e.input),n}function Ir(e){return typeof e.constructor=="function"&&!Tt(e)?mr(Kn(e)):{}}function Dr(e,t,n,r){var c=e.constructor;switch(t){case et:return _e(e);case We:case Be:return new c(+e);case Q:return Sr(e,r);case tt:case nt:case rt:case it:case ot:case st:case at:case ct:case ut:return xr(e,r);case Y:return vr(e,r,n);case qe:case Ze:return new c(e);case Xe:return Er(e);case q:return Ar(e,r,n);case ze:return Tr(e)}}function Vr(e,t){return t=t==null?Ue:t,!!t&&(typeof e=="number"||En.test(e))&&e>-1&&e%1==0&&e<t}function Mr(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function Lr(e){return!!dt&&dt in e}function Tt(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||X;return e===n}function N(e){if(e!=null){try{return mt.call(e)}catch(t){}try{return e+""}catch(t){}}return""}function Kr(e){return Oe(e,!0,!0)}function xt(e,t){return e===t||e!==e&&t!==t}function Hr(e){return Jr(e)&&x.call(e,"callee")&&(!Jn.call(e,"callee")||Z.call(e)==fe)}var Se=Array.isArray;function jt(e){return e!=null&&Fr(e.length)&&!Pt(e)}function Jr(e){return Rr(e)&&jt(e)}var kr=Fn||Ur;function Pt(e){var t=te(e)?Z.call(e):"";return t==he||t==Ye}function Fr(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Ue}function te(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function Rr(e){return!!e&&typeof e=="object"}function ve(e){return jt(e)?yr(e):Or(e)}function Gr(){return[]}function Ur(){return!1}H.exports=Kr});var Vt=D((lo,Dt)=>{var Wr="[object Object]";function Br(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch(n){}return t}function Yr(e,t){return function(n){return e(t(n))}}var qr=Function.prototype,Ct=Object.prototype,It=qr.toString,Qr=Ct.hasOwnProperty,Xr=It.call(Object),Zr=Ct.toString,zr=Yr(Object.getPrototypeOf,Object);function ei(e){return!!e&&typeof e=="object"}function ti(e){if(!ei(e)||Zr.call(e)!=Wr||Br(e))return!1;var t=zr(e);if(t===null)return!0;var n=Qr.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&It.call(n)==Xr}Dt.exports=ti});var Yt=D((po,Bt)=>{var Te="__lodash_hash_undefined__",ri=9007199254740991,ii="[object Function]",oi="[object GeneratorFunction]",si=/[\\^$.*+?()[\]{}|]/g,ai=/^\[object .+?Constructor\]$/,ci=typeof global=="object"&&global&&global.Object===Object&&global,ui=typeof self=="object"&&self&&self.Object===Object&&self,Lt=ci||ui||Function("return this")();function li(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function fi(e,t){var n=e?e.length:0;return!!n&&pi(e,t,0)>-1}function hi(e,t,n){for(var r=-1,c=e?e.length:0;++r<c;)if(n(t,e[r]))return!0;return!1}function Kt(e,t){for(var n=-1,r=e?e.length:0,c=Array(r);++n<r;)c[n]=t(e[n],n,e);return c}function gi(e,t,n,r){for(var c=e.length,l=n+(r?1:-1);r?l--:++l<c;)if(t(e[l],l,e))return l;return-1}function pi(e,t,n){if(t!==t)return gi(e,yi,n);for(var r=n-1,c=e.length;++r<c;)if(e[r]===t)return r;return-1}function yi(e){return e!==e}function di(e){return function(t){return e(t)}}function Ht(e,t){return e.has(t)}function mi(e,t){return e==null?void 0:e[t]}function bi(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch(n){}return t}var $i=Array.prototype,wi=Function.prototype,Jt=Object.prototype,xe=Lt["__core-js_shared__"],kt=function(){var e=/[^.]+$/.exec(xe&&xe.keys&&xe.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),Ft=wi.toString,je=Jt.hasOwnProperty,Oi=Jt.toString,_i=RegExp("^"+Ft.call(je).replace(si,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Si=$i.splice,Rt=Math.max,vi=Math.min,Ei=Gt(Lt,"Map"),B=Gt(Object,"create");function C(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Ai(){this.__data__=B?B(null):{}}function Ti(e){return this.has(e)&&delete this.__data__[e]}function xi(e){var t=this.__data__;if(B){var n=t[e];return n===Te?void 0:n}return je.call(t,e)?t[e]:void 0}function ji(e){var t=this.__data__;return B?t[e]!==void 0:je.call(t,e)}function Pi(e,t){var n=this.__data__;return n[e]=B&&t===void 0?Te:t,this}C.prototype.clear=Ai;C.prototype.delete=Ti;C.prototype.get=xi;C.prototype.has=ji;C.prototype.set=Pi;function J(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Ni(){this.__data__=[]}function Ci(e){var t=this.__data__,n=ie(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():Si.call(t,n,1),!0}function Ii(e){var t=this.__data__,n=ie(t,e);return n<0?void 0:t[n][1]}function Di(e){return ie(this.__data__,e)>-1}function Vi(e,t){var n=this.__data__,r=ie(n,e);return r<0?n.push([e,t]):n[r][1]=t,this}J.prototype.clear=Ni;J.prototype.delete=Ci;J.prototype.get=Ii;J.prototype.has=Di;J.prototype.set=Vi;function k(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Mi(){this.__data__={hash:new C,map:new(Ei||J),string:new C}}function Li(e){return oe(this,e).delete(e)}function Ki(e){return oe(this,e).get(e)}function Hi(e){return oe(this,e).has(e)}function Ji(e,t){return oe(this,e).set(e,t),this}k.prototype.clear=Mi;k.prototype.delete=Li;k.prototype.get=Ki;k.prototype.has=Hi;k.prototype.set=Ji;function re(e){var t=-1,n=e?e.length:0;for(this.__data__=new k;++t<n;)this.add(e[t])}function ki(e){return this.__data__.set(e,Te),this}function Fi(e){return this.__data__.has(e)}re.prototype.add=re.prototype.push=ki;re.prototype.has=Fi;function ie(e,t){for(var n=e.length;n--;)if(Xi(e[n][0],t))return n;return-1}function Ri(e,t,n){for(var r=n?hi:fi,c=e[0].length,l=e.length,d=l,g=Array(l),i=1/0,m=[];d--;){var o=e[d];d&&t&&(o=Kt(o,di(t))),i=vi(o.length,i),g[d]=!n&&(t||c>=120&&o.length>=120)?new re(d&&o):void 0}o=e[0];var a=-1,y=g[0];e:for(;++a<c&&m.length<i;){var h=o[a],$=t?t(h):h;if(h=n||h!==0?h:0,!(y?Ht(y,$):r(m,$,n))){for(d=l;--d;){var S=g[d];if(!(S?Ht(S,$):r(e[d],$,n)))continue e}y&&y.push($),m.push(h)}}return m}function Gi(e){if(!Wt(e)||Yi(e))return!1;var t=Ut(e)||bi(e)?_i:ai;return t.test(qi(e))}function Ui(e,t){return t=Rt(t===void 0?e.length-1:t,0),function(){for(var n=arguments,r=-1,c=Rt(n.length-t,0),l=Array(c);++r<c;)l[r]=n[t+r];r=-1;for(var d=Array(t+1);++r<t;)d[r]=n[r];return d[t]=l,li(e,this,d)}}function Wi(e){return zi(e)?e:[]}function oe(e,t){var n=e.__data__;return Bi(t)?n[typeof t=="string"?"string":"hash"]:n.map}function Gt(e,t){var n=mi(e,t);return Gi(n)?n:void 0}function Bi(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function Yi(e){return!!kt&&kt in e}function qi(e){if(e!=null){try{return Ft.call(e)}catch(t){}try{return e+""}catch(t){}}return""}var Qi=Ui(function(e){var t=Kt(e,Wi);return t.length&&t[0]===e[0]?Ri(t):[]});function Xi(e,t){return e===t||e!==e&&t!==t}function Zi(e){return e!=null&&eo(e.length)&&!Ut(e)}function zi(e){return to(e)&&Zi(e)}function Ut(e){var t=Wt(e)?Oi.call(e):"";return t==ii||t==oi}function eo(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=ri}function Wt(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function to(e){return!!e&&typeof e=="object"}Bt.exports=Qi});var Qt=D((qt,se)=>{(function(e,t){"use strict";typeof se=="object"&&typeof se.exports=="object"?se.exports=t():typeof define=="function"&&define.amd?define([],t):e.objectPath=t()})(qt,function(){"use strict";var e=Object.prototype.toString;function t(o,a){return o==null?!1:Object.prototype.hasOwnProperty.call(o,a)}function n(o){if(!o||l(o)&&o.length===0)return!0;if(typeof o!="string"){for(var a in o)if(t(o,a))return!1;return!0}return!1}function r(o){return e.call(o)}function c(o){return typeof o=="object"&&r(o)==="[object Object]"}var l=Array.isArray||function(o){return e.call(o)==="[object Array]"};function d(o){return typeof o=="boolean"||r(o)==="[object Boolean]"}function g(o){var a=parseInt(o);return a.toString()===o?a:o}function i(o){o=o||{};var a=function(f){return Object.keys(a).reduce(function(s,u){return u==="create"||typeof a[u]=="function"&&(s[u]=a[u].bind(a,f)),s},{})},y;o.includeInheritedProps?y=function(){return!0}:y=function(f,s){return typeof s=="number"&&Array.isArray(f)||t(f,s)};function h(f,s){if(y(f,s))return f[s]}var $;o.includeInheritedProps?$=function(f,s){typeof s!="string"&&typeof s!="number"&&(s=String(s));var u=h(f,s);if(s==="__proto__"||s==="prototype"||s==="constructor"&&typeof u=="function")throw new Error("For security reasons, object's magic properties cannot be set");return u}:$=function(f,s){return h(f,s)};function S(f,s,u,p){if(typeof s=="number"&&(s=[s]),!s||s.length===0)return f;if(typeof s=="string")return S(f,s.split(".").map(g),u,p);var w=s[0],O=$(f,w);return s.length===1?((O===void 0||!p)&&(f[w]=u),O):(O===void 0&&(typeof s[1]=="number"?f[w]=[]:f[w]={}),S(f[w],s.slice(1),u,p))}return a.has=function(f,s){if(typeof s=="number"?s=[s]:typeof s=="string"&&(s=s.split(".")),!s||s.length===0)return!!f;for(var u=0;u<s.length;u++){var p=g(s[u]);if(typeof p=="number"&&l(f)&&p<f.length||(o.includeInheritedProps?p in Object(f):t(f,p)))f=f[p];else return!1}return!0},a.ensureExists=function(f,s,u){return S(f,s,u,!0)},a.set=function(f,s,u,p){return S(f,s,u,p)},a.insert=function(f,s,u,p){var w=a.get(f,s);p=~~p,l(w)||(w=[],a.set(f,s,w)),w.splice(p,0,u)},a.empty=function(f,s){if(!n(s)&&f!=null){var u,p;if(!!(u=a.get(f,s))){if(typeof u=="string")return a.set(f,s,"");if(d(u))return a.set(f,s,!1);if(typeof u=="number")return a.set(f,s,0);if(l(u))u.length=0;else if(c(u))for(p in u)y(u,p)&&delete u[p];else return a.set(f,s,null)}}},a.push=function(f,s){var u=a.get(f,s);l(u)||(u=[],a.set(f,s,u)),u.push.apply(u,Array.prototype.slice.call(arguments,2))},a.coalesce=function(f,s,u){for(var p,w=0,O=s.length;w<O;w++)if((p=a.get(f,s[w]))!==void 0)return p;return u},a.get=function(f,s,u){if(typeof s=="number"&&(s=[s]),!s||s.length===0)return f;if(f==null)return u;if(typeof s=="string")return a.get(f,s.split("."),u);var p=g(s[0]),w=$(f,p);return w===void 0?u:s.length===1?w:a.get(f[p],s.slice(1),u)},a.del=function(s,u){if(typeof u=="number"&&(u=[u]),s==null||n(u))return s;if(typeof u=="string")return a.del(s,u.split("."));var p=g(u[0]);if($(s,p),!y(s,p))return s;if(u.length===1)l(s)?s.splice(p,1):delete s[p];else return a.del(s[p],u.slice(1));return s},a}var m=i();return m.create=i,m.withInheritedProps=i({includeInheritedProps:!0}),m})});var ao={};an(ao,{checkTypesMini:()=>so});var _=V(Je(),1),I=V(Re(),1);var ne=V(Nt(),1),Mt=V(Vt(),1);function ni(e){if(e.includes(".")){let t=e.lastIndexOf(".");if(!e.slice(0,t).includes("."))return e.slice(0,t);for(let n=t-1;n--;)if(e[n]===".")return e.slice(n+1,t)}return null}var Ee=ni;function Ae(e,t){let n={now:!1};function r(c,l,d,g){let i=(0,ne.default)(c),m,o=E({depth:-1,path:""},d);if(o.depth+=1,Array.isArray(i))for(let a=0,y=i.length;a<y&&!g.now;a++){let h=o.path?`${o.path}.${a}`:`${a}`;i[a]!==void 0?(o.parent=(0,ne.default)(i),o.parentType="array",o.parentKey=Ee(h),m=r(l(i[a],void 0,R(E({},o),{path:h}),g),l,R(E({},o),{path:h}),g),Number.isNaN(m)&&a<i.length?(i.splice(a,1),a-=1):i[a]=m):i.splice(a,1)}else if((0,Mt.default)(i))for(let a in i){if(g.now&&a!=null)break;let y=o.path?`${o.path}.${a}`:a;o.depth===0&&a!=null&&(o.topmostKey=a),o.parent=(0,ne.default)(i),o.parentType="object",o.parentKey=Ee(y),m=r(l(a,i[a],R(E({},o),{path:y}),g),l,R(E({},o),{path:y}),g),Number.isNaN(m)?delete i[a]:i[a]=m}return i}return r(e,t,{},n)}var Zt=V(Yt(),1);function Pe(e){return typeof e=="string"?e.length?[e]:[]:e}var ce=V(Qt(),1);function Ne(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}var Ce=new Map,Xt=(e,t)=>{if(!Array.isArray(e))switch(typeof e){case"string":e=[e];break;case"undefined":e=[];break;default:throw new TypeError(`Expected '${t}' to be a string or an array, but got a type of '${typeof e}'`)}return e.filter(n=>{if(typeof n!="string"){if(typeof n=="undefined")return!1;throw new TypeError(`Expected '${t}' to be an array of strings, but found a type of '${typeof n}' in the array`)}return!0})},no=(e,t)=>{t=E({caseSensitive:!1},t);let n=e+JSON.stringify(t);if(Ce.has(n))return Ce.get(n);let r=e[0]==="!";r&&(e=e.slice(1)),e=Ne(e).replace(/\\\*/g,"[\\s\\S]*");let c=new RegExp(`^${e}$`,t.caseSensitive?"":"i");return c.negated=r,Ce.set(n,c),c},ro=(e,t,n,r)=>{if(e=Xt(e,"inputs"),t=Xt(t,"patterns"),t.length===0)return[];t=t.map(d=>no(d,n));let{allPatterns:c}=n||{},l=[];for(let d of e){let g,i=[...t].fill(!1);for(let[m,o]of t.entries())if(o.test(d)&&(i[m]=!0,g=!o.negated,!g))break;if(!(g===!1||g===void 0&&t.some(m=>!m.negated)||c&&i.some((m,o)=>!m&&!t[o].negated))&&(l.push(d),r))break}return l};function ae(e,t,n){return ro(e,t,n,!0).length>0}var io={ignoreKeys:[],ignorePaths:[],acceptArrays:!1,acceptArraysIgnore:[],enforceStrictKeyset:!0,schema:{},msg:"check-types-mini",optsVarName:"opts"};function oo(e,t,n){function r(o){return o!=null}function c(o){return(0,_.default)(o)==="Object"}function l(o,a){return typeof a=="string"&&(a=Pe(a)),Array.from(o).filter(y=>!a.some(h=>ae(y,h,{caseSensitive:!0})))}let d=Object.prototype.hasOwnProperty,g=["any","anything","every","everything","all","whatever","whatevs"];if(!r(e))throw new Error("check-types-mini: [THROW_ID_01] First argument is missing!");let i=E(E({},io),n);if(typeof i.ignoreKeys=="string"&&(i.ignoreKeys=[i.ignoreKeys]),typeof i.ignorePaths=="string"&&(i.ignorePaths=[i.ignorePaths]),typeof i.acceptArraysIgnore=="string"&&(i.acceptArraysIgnore=[i.acceptArraysIgnore]),i.msg=`${i.msg}`.trim(),i.msg[i.msg.length-1]===":"&&(i.msg=i.msg.slice(0,i.msg.length-1).trim()),c(i.schema))Object.keys(i.schema).forEach(o=>{if(c(i.schema[o])){let a={};Ae(i.schema[o],(y,h,$)=>{let S=h!==void 0?h:y;return!Array.isArray(S)&&!c(S)&&(a[`${o}.${$.path}`]=S),S}),delete i.schema[o],i.schema=E(E({},i.schema),a)}}),Object.keys(i.schema).forEach(o=>{Array.isArray(i.schema[o])||(i.schema[o]=[i.schema[o]]),i.schema[o]=i.schema[o].map(a=>`${a}`.toLowerCase().trim())});else if(i.schema!=null)throw new Error(`check-types-mini: opts.schema was customised to ${JSON.stringify(i.schema,null,0)} which is not object but ${typeof i.schema}`);if(r(t)||(t={}),i.enforceStrictKeyset)if(r(i.schema)&&Object.keys(i.schema).length>0){if(t&&l((0,I.default)(Object.keys(e),Object.keys(t).concat(Object.keys(i.schema))),i.ignoreKeys).length){let o=(0,I.default)(Object.keys(e),Object.keys(t).concat(Object.keys(i.schema)));throw new TypeError(`${i.msg}: ${i.optsVarName}.enforceStrictKeyset is on and the following key${o.length>1?"s":""} ${o.length>1?"are":"is"} not covered by schema and/or reference objects: ${o.join(", ")}`)}}else if(c(t)&&Object.keys(t).length>0){if(l((0,I.default)(Object.keys(e),Object.keys(t)),i.ignoreKeys).length!==0){let o=(0,I.default)(Object.keys(e),Object.keys(t));throw new TypeError(`${i.msg}: The input object has key${o.length>1?"s":""} which ${o.length>1?"are":"is"} not covered by the reference object: ${o.join(", ")}`)}else if(l((0,I.default)(Object.keys(t),Object.keys(e)),i.ignoreKeys).length!==0){let o=(0,I.default)(Object.keys(t),Object.keys(e));throw new TypeError(`${i.msg}: The reference object has key${o.length>1?"s":""} which ${o.length>1?"are":"is"} not present in the input object: ${o.join(", ")}`)}}else throw new TypeError(`${i.msg}: Both ${i.optsVarName}.schema and reference objects are missing! We don't have anything to match the keys as you requested via opts.enforceStrictKeyset!`);let m=[];Ae(e,(o,a,y)=>{let h=a,$=o;if(y.parentType==="array"&&($=void 0,h=o),Array.isArray(m)&&m.length&&m.some(u=>y.path.startsWith(u))||$&&i.ignoreKeys.some(u=>ae($,u))||i.ignorePaths.some(u=>ae(y.path,u)))return h;let S=!(!c(h)&&!Array.isArray(h)&&Array.isArray(y.parent)),f=!1;c(i.schema)&&d.call(i.schema,y.path)&&(f=!0);let s=!1;if(c(t)&&ce.default.has(t,y.path)&&(s=!0),i.enforceStrictKeyset&&S&&!f&&!s)throw new TypeError(`${i.msg}: ${i.optsVarName}.${y.path} is neither covered by reference object (second input argument), nor ${i.optsVarName}.schema! To stop this error, turn off ${i.optsVarName}.enforceStrictKeyset or provide some type reference (2nd argument or ${i.optsVarName}.schema).
|
|
11
|
+
|
|
12
|
+
Debug info:
|
|
13
|
+
|
|
14
|
+
obj = ${JSON.stringify(e,null,4)}
|
|
15
|
+
|
|
16
|
+
ref = ${JSON.stringify(t,null,4)}
|
|
17
|
+
|
|
18
|
+
innerObj = ${JSON.stringify(y,null,4)}
|
|
19
|
+
|
|
20
|
+
opts = ${JSON.stringify(i,null,4)}
|
|
21
|
+
|
|
22
|
+
current = ${JSON.stringify(h,null,4)}
|
|
23
|
+
|
|
24
|
+
`);if(f){let u=Pe(i.schema[y.path]).map(p=>`${p}`.toLowerCase());if(ce.default.set(i.schema,y.path,u),(0,Zt.default)(u,g).length)m.push(y.path);else if(h!==!0&&h!==!1&&!u.includes((0,_.default)(h).toLowerCase())||(h===!0||h===!1)&&!u.includes(String(h))&&!u.includes("boolean"))if(Array.isArray(h)&&i.acceptArrays){for(let p=0,w=h.length;p<w;p++)if(!u.includes((0,_.default)(h[p]).toLowerCase()))throw new TypeError(`${i.msg}: ${i.optsVarName}.${y.path}.${p}, the ${p}th element (equal to ${JSON.stringify(h[p],null,0)}) is of a type ${(0,_.default)(h[p]).toLowerCase()}, but only the following are allowed by the ${i.optsVarName}.schema: ${u.join(", ")}`)}else throw new TypeError(`${i.msg}: ${i.optsVarName}.${y.path} was customised to ${(0,_.default)(h)!=="string"?'"':""}${JSON.stringify(h,null,0)}${(0,_.default)(h)!=="string"?'"':""} (type: ${(0,_.default)(h).toLowerCase()}) which is not among the allowed types in schema (which is equal to ${JSON.stringify(u,null,0)})`)}else if(t&&c(t)&&s){let u=ce.default.get(t,y.path);if(i.acceptArrays&&Array.isArray(h)&&!i.acceptArraysIgnore.includes(o)){if(!h.every(w=>(0,_.default)(w).toLowerCase()===(0,_.default)(t[o]).toLowerCase()))throw new TypeError(`${i.msg}: ${i.optsVarName}.${y.path} was customised to be array, but not all of its elements are ${(0,_.default)(t[o]).toLowerCase()}-type`)}else if((0,_.default)(h)!==(0,_.default)(u))throw new TypeError(`${i.msg}: ${i.optsVarName}.${y.path} was customised to ${(0,_.default)(h).toLowerCase()==="string"?"":'"'}${JSON.stringify(h,null,0)}${(0,_.default)(h).toLowerCase()==="string"?"":'"'} which is not ${(0,_.default)(u).toLowerCase()} but ${(0,_.default)(h).toLowerCase()}`)}return h})}function so(e,t,n){oo(e,t,n)}return cn(ao);})();
|
|
11
25
|
/**
|
|
12
|
-
* @name
|
|
13
|
-
* @fileoverview
|
|
14
|
-
* @version
|
|
26
|
+
* @name arrayiffy-if-string
|
|
27
|
+
* @fileoverview Put non-empty strings into arrays, turn empty-ones into empty arrays. Bypass everything else.
|
|
28
|
+
* @version 4.0.10
|
|
15
29
|
* @author Roy Revelt, Codsen Ltd
|
|
16
30
|
* @license MIT
|
|
17
|
-
* {@link https://codsen.com/os/
|
|
18
|
-
*/
|
|
31
|
+
* {@link https://codsen.com/os/arrayiffy-if-string/}
|
|
32
|
+
*/
|
|
19
33
|
/**
|
|
20
34
|
* @name ast-monkey-traverse
|
|
21
35
|
* @fileoverview Utility library to traverse AST
|
|
22
|
-
* @version 3.0.
|
|
36
|
+
* @version 3.0.10
|
|
23
37
|
* @author Roy Revelt, Codsen Ltd
|
|
24
38
|
* @license MIT
|
|
25
39
|
* {@link https://codsen.com/os/ast-monkey-traverse/}
|
|
26
|
-
*/
|
|
40
|
+
*/
|
|
27
41
|
/**
|
|
28
|
-
* @name
|
|
29
|
-
* @fileoverview
|
|
30
|
-
* @version
|
|
42
|
+
* @name ast-monkey-util
|
|
43
|
+
* @fileoverview Utility library of AST helper functions
|
|
44
|
+
* @version 2.0.10
|
|
31
45
|
* @author Roy Revelt, Codsen Ltd
|
|
32
46
|
* @license MIT
|
|
33
|
-
* {@link https://codsen.com/os/
|
|
34
|
-
*/
|
|
47
|
+
* {@link https://codsen.com/os/ast-monkey-util/}
|
|
48
|
+
*/
|
package/examples/_quickTake.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "check-types-mini",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.10",
|
|
4
4
|
"description": "Validate options object",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"compare",
|
|
@@ -35,58 +35,39 @@
|
|
|
35
35
|
},
|
|
36
36
|
"types": "types/index.d.ts",
|
|
37
37
|
"scripts": {
|
|
38
|
-
"build": "
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"prettier": "../../node_modules/prettier/bin-prettier.js '*.{js,css,scss,vue,md,ts}' --write --loglevel silent",
|
|
51
|
-
"republish": "npm publish || :",
|
|
52
|
-
"tap": "tap",
|
|
53
|
-
"pretest": "npm run build",
|
|
54
|
-
"test": "npm run lint && npm run unittest && npm run test:examples && npm run clean_cov && npm run format",
|
|
55
|
-
"test:examples": "../../scripts/test-examples.js && npm run lect && npm run prettier",
|
|
56
|
-
"tsc": "tsc",
|
|
57
|
-
"unittest": "tap --no-only --output-file=testStats.md --reporter=terse && tsc -p tsconfig.json --noEmit && npm run clean_cov && npm run perf"
|
|
38
|
+
"build": "node '../../ops/scripts/esbuild.js' && yarn run dts",
|
|
39
|
+
"dev": "DEV=true node '../../ops/scripts/esbuild.js' && yarn run dts",
|
|
40
|
+
"dts": "rollup -c",
|
|
41
|
+
"examples": "node '../../ops/scripts/run-examples.js'",
|
|
42
|
+
"lect": "node '../../ops/lect/lect.js'",
|
|
43
|
+
"letspublish": "yarn publish || :",
|
|
44
|
+
"lint": "eslint . --fix",
|
|
45
|
+
"perf": "node perf/check.js",
|
|
46
|
+
"prepare": "echo 'ready'",
|
|
47
|
+
"pretest": "yarn run lect && yarn run build",
|
|
48
|
+
"test": "c8 yarn run unit && yarn run examples && yarn run lint",
|
|
49
|
+
"unit": "uvu test"
|
|
58
50
|
},
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
"--no-warnings",
|
|
67
|
-
"--experimental-loader",
|
|
68
|
-
"@istanbuljs/esm-loader-hook"
|
|
51
|
+
"engines": {
|
|
52
|
+
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
|
53
|
+
},
|
|
54
|
+
"c8": {
|
|
55
|
+
"check-coverage": true,
|
|
56
|
+
"exclude": [
|
|
57
|
+
"**/test/**/*.*"
|
|
69
58
|
],
|
|
70
|
-
"
|
|
59
|
+
"lines": 100
|
|
71
60
|
},
|
|
72
61
|
"lect": {
|
|
73
62
|
"licence": {
|
|
74
63
|
"extras": [
|
|
75
64
|
""
|
|
76
65
|
]
|
|
77
|
-
},
|
|
78
|
-
"req": "{ checkTypesMini }",
|
|
79
|
-
"various": {
|
|
80
|
-
"devDependencies": [
|
|
81
|
-
"@types/lodash.intersection",
|
|
82
|
-
"@types/lodash.pullall"
|
|
83
|
-
]
|
|
84
66
|
}
|
|
85
67
|
},
|
|
86
68
|
"dependencies": {
|
|
87
|
-
"
|
|
88
|
-
"
|
|
89
|
-
"ast-monkey-traverse": "^3.0.4",
|
|
69
|
+
"arrayiffy-if-string": "^4.0.10",
|
|
70
|
+
"ast-monkey-traverse": "^3.0.10",
|
|
90
71
|
"lodash.intersection": "^4.4.0",
|
|
91
72
|
"lodash.pullall": "^4.2.0",
|
|
92
73
|
"matcher": "^5.0.0",
|
|
@@ -94,45 +75,7 @@
|
|
|
94
75
|
"type-detect": "^4.0.8"
|
|
95
76
|
},
|
|
96
77
|
"devDependencies": {
|
|
97
|
-
"@babel/cli": "^7.16.0",
|
|
98
|
-
"@babel/core": "^7.16.0",
|
|
99
|
-
"@babel/node": "^7.16.0",
|
|
100
|
-
"@babel/plugin-external-helpers": "^7.16.0",
|
|
101
|
-
"@babel/plugin-proposal-class-properties": "^7.16.0",
|
|
102
|
-
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.0",
|
|
103
|
-
"@babel/plugin-proposal-object-rest-spread": "^7.16.0",
|
|
104
|
-
"@babel/plugin-proposal-optional-chaining": "^7.16.0",
|
|
105
|
-
"@babel/plugin-transform-runtime": "^7.16.0",
|
|
106
|
-
"@babel/preset-env": "^7.16.0",
|
|
107
|
-
"@babel/preset-typescript": "^7.16.0",
|
|
108
|
-
"@babel/register": "^7.16.0",
|
|
109
|
-
"@istanbuljs/esm-loader-hook": "^0.1.2",
|
|
110
|
-
"@rollup/plugin-babel": "^5.3.0",
|
|
111
|
-
"@rollup/plugin-commonjs": "^21.0.1",
|
|
112
|
-
"@rollup/plugin-node-resolve": "^13.0.6",
|
|
113
|
-
"@rollup/plugin-strip": "^2.1.0",
|
|
114
|
-
"@rollup/plugin-typescript": "^8.3.0",
|
|
115
78
|
"@types/lodash.intersection": "^4.4.6",
|
|
116
|
-
"@types/lodash.pullall": "^4.2.6"
|
|
117
|
-
"@types/node": "^16.11.6",
|
|
118
|
-
"@types/tap": "^15.0.5",
|
|
119
|
-
"@typescript-eslint/eslint-plugin": "^5.3.0",
|
|
120
|
-
"@typescript-eslint/parser": "^5.3.0",
|
|
121
|
-
"core-js": "^3.19.1",
|
|
122
|
-
"cross-env": "^7.0.3",
|
|
123
|
-
"eslint": "^8.1.0",
|
|
124
|
-
"lect": "^0.18.4",
|
|
125
|
-
"rollup": "^2.59.0",
|
|
126
|
-
"rollup-plugin-ascii": "^0.0.3",
|
|
127
|
-
"rollup-plugin-banner": "^0.2.1",
|
|
128
|
-
"rollup-plugin-cleanup": "^3.2.1",
|
|
129
|
-
"rollup-plugin-dts": "^4.0.0",
|
|
130
|
-
"rollup-plugin-terser": "^7.0.2",
|
|
131
|
-
"tap": "^15.0.10",
|
|
132
|
-
"tslib": "^2.3.1",
|
|
133
|
-
"typescript": "^4.4.4"
|
|
134
|
-
},
|
|
135
|
-
"engines": {
|
|
136
|
-
"node": ">=12"
|
|
79
|
+
"@types/lodash.pullall": "^4.2.6"
|
|
137
80
|
}
|
|
138
81
|
}
|
package/types/index.d.ts
CHANGED
|
File without changes
|
package/examples/api.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"_quickTake.js":{"title":"Quick Take","content":"import { strict as assert } from \"assert\";\nimport { checkTypesMini } from \"check-types-mini\";\n\nassert.throws(() => {\n checkTypesMini(\n checkTypesMini(\n {\n // object to check\n option1: \"setting1\",\n option2: \"false\",\n option3: false,\n },\n {\n // reference defaults object\n option1: \"setting1\",\n option2: false,\n option3: false,\n }\n ),\n /not boolean but string/g\n );\n});"}}
|