check-types-mini 8.0.32 → 8.0.34
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/.eslintcache +1 -0
- package/LICENSE +2 -2
- package/README.md +2 -2
- package/dist/check-types-mini.esm.js +3 -3
- package/dist/check-types-mini.umd.js +11 -11
- package/package.json +5 -5
package/.eslintcache
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[{"/home/runner/work/codsen/codsen/packages/check-types-mini/examples/_quickTake.js":"1","/home/runner/work/codsen/codsen/packages/check-types-mini/perf/check.js":"2","/home/runner/work/codsen/codsen/packages/check-types-mini/rollup.config.js":"3","/home/runner/work/codsen/codsen/packages/check-types-mini/src/main.ts":"4","/home/runner/work/codsen/codsen/packages/check-types-mini/test/test.js":"5"},{"size":523,"mtime":1760280945887,"results":"6","hashOfConfig":"7"},{"size":559,"mtime":1760280945887,"results":"8","hashOfConfig":"9"},{"size":373,"mtime":1760280945887,"results":"10","hashOfConfig":"7"},{"size":25211,"mtime":1760280945887,"results":"11","hashOfConfig":"9"},{"size":53849,"mtime":1760280945887,"results":"12","hashOfConfig":"13"},{"filePath":"14","messages":"15","suppressedMessages":"16","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"1f1u168",{"filePath":"17","messages":"18","suppressedMessages":"19","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"91l1rm",{"filePath":"20","messages":"21","suppressedMessages":"22","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"23","messages":"24","suppressedMessages":"25","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"26","messages":"27","suppressedMessages":"28","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"ns3qdb","/home/runner/work/codsen/codsen/packages/check-types-mini/examples/_quickTake.js",[],[],"/home/runner/work/codsen/codsen/packages/check-types-mini/perf/check.js",[],[],"/home/runner/work/codsen/codsen/packages/check-types-mini/rollup.config.js",[],[],"/home/runner/work/codsen/codsen/packages/check-types-mini/src/main.ts",[],[],"/home/runner/work/codsen/codsen/packages/check-types-mini/test/test.js",[],["29","30","31","32","33"],{"ruleId":"34","severity":2,"message":"35","line":3,"column":10,"nodeType":null,"messageId":"36","endLine":3,"endColumn":15,"suppressions":"37"},{"ruleId":"34","severity":2,"message":"38","line":3,"column":17,"nodeType":null,"messageId":"36","endLine":3,"endColumn":19,"suppressions":"39"},{"ruleId":"34","severity":2,"message":"40","line":3,"column":21,"nodeType":null,"messageId":"36","endLine":3,"endColumn":23,"suppressions":"41"},{"ruleId":"34","severity":2,"message":"42","line":3,"column":33,"nodeType":null,"messageId":"36","endLine":3,"endColumn":37,"suppressions":"43"},{"ruleId":"34","severity":2,"message":"44","line":3,"column":44,"nodeType":null,"messageId":"36","endLine":3,"endColumn":49,"suppressions":"45"},"@typescript-eslint/no-unused-vars","'equal' is defined but never used.","unusedVar",["46"],"'is' is defined but never used.",["47"],"'ok' is defined but never used.",["48"],"'type' is defined but never used.",["49"],"'match' is defined but never used.",["50"],{"kind":"51","justification":"52"},{"kind":"51","justification":"52"},{"kind":"51","justification":"52"},{"kind":"51","justification":"52"},{"kind":"51","justification":"52"},"directive",""]
|
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright
|
|
3
|
+
Copyright © 2010-2025 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
|
|
@@ -19,4 +19,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
|
19
19
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
20
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
21
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -70,8 +70,8 @@ To report bugs or request features or assistance, [raise an issue](https://githu
|
|
|
70
70
|
|
|
71
71
|
## Licence
|
|
72
72
|
|
|
73
|
-
MIT License
|
|
73
|
+
MIT License
|
|
74
74
|
|
|
75
|
-
Copyright © 2010-2025 Roy Revelt and other contributors
|
|
75
|
+
Copyright © 2010-2025 Roy Revelt and other contributors
|
|
76
76
|
|
|
77
77
|
<p align="center"><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"></p>
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @name check-types-mini
|
|
3
3
|
* @fileoverview Validate options object
|
|
4
|
-
* @version 8.0.
|
|
5
|
-
* @author Roy Revelt
|
|
4
|
+
* @version 8.0.34
|
|
5
|
+
* @author Roy Revelt
|
|
6
6
|
* @license MIT
|
|
7
7
|
* {@link https://codsen.com/os/check-types-mini/}
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import i from"type-detect";import{traverse as w}from"ast-monkey-traverse";import{arrayiffy as N}from"arrayiffy-if-string";import E from"object-path";import{isMatch as S}from"matcher";import{isPlainObject as m,pullAll as g,intersection as k}from"codsen-utils";var j="8.0.
|
|
10
|
+
import i from"type-detect";import{traverse as w}from"ast-monkey-traverse";import{arrayiffy as N}from"arrayiffy-if-string";import E from"object-path";import{isMatch as S}from"matcher";import{isPlainObject as m,pullAll as g,intersection as k}from"codsen-utils";var j="8.0.34";var R=j,v={ignoreKeys:[],ignorePaths:[],acceptArrays:!1,acceptArraysIgnore:[],enforceStrictKeyset:!0,schema:{},msg:"check-types-mini",optsVarName:"opts"};function T(a,r,p){function y(s){return s!=null}function b(s,l){return typeof l=="string"&&(l=N(l)),Array.from(s).filter(n=>!l.some(t=>S(n,t,{caseSensitive:!0})))}let V=Object.prototype.hasOwnProperty,A=["any","anything","every","everything","all","whatever","whatevs"];if(!y(a))throw new Error("check-types-mini: [THROW_ID_01] First argument is missing!");let e={...v,...p};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()),m(e.schema))Object.keys(e.schema).forEach(s=>{if(m(e.schema[s])){let l={};w(e.schema[s],(n,t,$)=>{let u=t!==void 0?t:n;return!Array.isArray(u)&&!m(u)&&(l[`${s}.${$.path}`]=u),u}),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(y(r)||(r={}),e.enforceStrictKeyset)if(y(e.schema)&&Object.keys(e.schema).length){if(r&&b(g(Object.keys(a),Object.keys(r).concat(Object.keys(e.schema))),e.ignoreKeys).length){let s=g(Object.keys(a),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(m(r)&&Object.keys(r).length){if(b(g(Object.keys(a),Object.keys(r)),e.ignoreKeys).length!==0){let s=g(Object.keys(a),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(b(g(Object.keys(r),Object.keys(a)),e.ignoreKeys).length!==0){let s=g(Object.keys(r),Object.keys(a));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 resolvedOpts.enforceStrictKeyset!`);let h=[];w(a,(s,l,n)=>{let t=l,$=s;if(n.parentType==="array"&&($=void 0,t=s),Array.isArray(h)&&h.length&&h.some(o=>n.path.startsWith(o))||$&&e.ignoreKeys.some(o=>$&&S($,o))||e.ignorePaths.some(o=>S(n.path,o)))return t;let u=!(!m(t)&&!Array.isArray(t)&&Array.isArray(n.parent)),f=!1;m(e.schema)&&V.call(e.schema,n.path)&&(f=!0);let d=!1;if(m(r)&&E.has(r,n.path)&&(d=!0),e.enforceStrictKeyset&&u&&!f&&!d)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).
|
|
11
11
|
|
|
12
12
|
Debug info:
|
|
13
13
|
|
|
@@ -1,42 +1,42 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @name check-types-mini
|
|
3
3
|
* @fileoverview Validate options object
|
|
4
|
-
* @version 8.0.
|
|
5
|
-
* @author Roy Revelt
|
|
4
|
+
* @version 8.0.34
|
|
5
|
+
* @author Roy Revelt
|
|
6
6
|
* @license MIT
|
|
7
7
|
* {@link https://codsen.com/os/check-types-mini/}
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
"use strict";var checkTypesMini=(()=>{var fe=Object.create,U=Object.freeze,N=Object.defineProperty,pe=Object.defineProperties,ye=Object.getOwnPropertyDescriptor,ge=Object.getOwnPropertyDescriptors,me=Object.getOwnPropertyNames,Q=Object.getOwnPropertySymbols,he=Object.getPrototypeOf,Y=Object.prototype.hasOwnProperty,$e=Object.prototype.propertyIsEnumerable;var q=(e,t,c)=>t in e?N(e,t,{enumerable:!0,configurable:!0,writable:!0,value:c}):e[t]=c,E=(e,t)=>{for(var c in t||(t={}))Y.call(t,c)&&q(e,c,t[c]);if(Q)for(var c of Q(t))$e.call(t,c)&&q(e,c,t[c]);return e},j=(e,t)=>pe(e,ge(t));var J=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),de=(e,t)=>{for(var c in t)N(e,c,{get:t[c],enumerable:!0})},z=(e,t,c,g)=>{if(t&&typeof t=="object"||typeof t=="function")for(let y of me(t))!Y.call(e,y)&&y!==c&&N(e,y,{get:()=>t[y],enumerable:!(g=ye(t,y))||g.enumerable});return e};var T=(e,t,c)=>(c=e!=null?fe(he(e)):{},z(t||!e||!e.__esModule?N(c,"default",{value:e,enumerable:!0}):c,e)),be=e=>z(N({},"__esModule",{value:!0}),e);var x=(e,t)=>U(N(e,"raw",{value:U(t||e.slice())}));var Z=J((K,M)=>{(function(e,t){typeof K=="object"&&typeof M<"u"?M.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof globalThis<"u"?globalThis:e||self,e.typeDetect=t())})(K,(function(){"use strict";var e=typeof Promise=="function",t=(function(d){if(typeof globalThis=="object")return globalThis;Object.defineProperty(d,"typeDetectGlobalObject",{get:function(){return this},configurable:!0});var P=typeDetectGlobalObject;return delete d.typeDetectGlobalObject,P})(Object.prototype),c=typeof Symbol<"u",g=typeof Map<"u",y=typeof Set<"u",h=typeof WeakMap<"u",p=typeof WeakSet<"u",n=typeof DataView<"u",o=c&&typeof Symbol.iterator<"u",i=c&&typeof Symbol.toStringTag<"u",a=y&&typeof Set.prototype.entries=="function",r=g&&typeof Map.prototype.entries=="function",l=a&&Object.getPrototypeOf(new Set().entries()),b=r&&Object.getPrototypeOf(new Map().entries()),$=o&&typeof Array.prototype[Symbol.iterator]=="function",S=$&&Object.getPrototypeOf([][Symbol.iterator]()),f=o&&typeof String.prototype[Symbol.iterator]=="function",s=f&&Object.getPrototypeOf(""[Symbol.iterator]()),u=8,m=-1;function O(d){var P=typeof d;if(P!=="object")return P;if(d===null)return"null";if(d===t)return"global";if(Array.isArray(d)&&(i===!1||!(Symbol.toStringTag in d)))return"Array";if(typeof window=="object"&&window!==null){if(typeof window.location=="object"&&d===window.location)return"Location";if(typeof window.document=="object"&&d===window.document)return"Document";if(typeof window.navigator=="object"){if(typeof window.navigator.mimeTypes=="object"&&d===window.navigator.mimeTypes)return"MimeTypeArray";if(typeof window.navigator.plugins=="object"&&d===window.navigator.plugins)return"PluginArray"}if((typeof window.HTMLElement=="function"||typeof window.HTMLElement=="object")&&d instanceof window.HTMLElement){if(d.tagName==="BLOCKQUOTE")return"HTMLQuoteElement";if(d.tagName==="TD")return"HTMLTableDataCellElement";if(d.tagName==="TH")return"HTMLTableHeaderCellElement"}}var L=i&&d[Symbol.toStringTag];if(typeof L=="string")return L;var A=Object.getPrototypeOf(d);return A===RegExp.prototype?"RegExp":A===Date.prototype?"Date":e&&A===Promise.prototype?"Promise":y&&A===Set.prototype?"Set":g&&A===Map.prototype?"Map":p&&A===WeakSet.prototype?"WeakSet":h&&A===WeakMap.prototype?"WeakMap":n&&A===DataView.prototype?"DataView":g&&A===b?"Map Iterator":y&&A===l?"Set Iterator":$&&A===S?"Array Iterator":f&&A===s?"String Iterator":A===null?"Object":Object.prototype.toString.call(d).slice(u,m)}return O}))});var H=J((Pe,X)=>{"use strict";X.exports=Oe;function k(e){return e instanceof Buffer?Buffer.from(e):new e.constructor(e.buffer.slice(),e.byteOffset,e.length)}function Oe(e){if(e=e||{},e.circles)return we(e);let t=new Map;if(t.set(Date,p=>new Date(p)),t.set(Map,(p,n)=>new Map(g(Array.from(p),n))),t.set(Set,(p,n)=>new Set(g(Array.from(p),n))),e.constructorHandlers)for(let p of e.constructorHandlers)t.set(p[0],p[1]);let c=null;return e.proto?h:y;function g(p,n){let o=Object.keys(p),i=new Array(o.length);for(let a=0;a<o.length;a++){let r=o[a],l=p[r];typeof l!="object"||l===null?i[r]=l:l.constructor!==Object&&(c=t.get(l.constructor))?i[r]=c(l,n):ArrayBuffer.isView(l)?i[r]=k(l):i[r]=n(l)}return i}function y(p){if(typeof p!="object"||p===null)return p;if(Array.isArray(p))return g(p,y);if(p.constructor!==Object&&(c=t.get(p.constructor)))return c(p,y);let n={};for(let o in p){if(Object.hasOwnProperty.call(p,o)===!1)continue;let i=p[o];typeof i!="object"||i===null?n[o]=i:i.constructor!==Object&&(c=t.get(i.constructor))?n[o]=c(i,y):ArrayBuffer.isView(i)?n[o]=k(i):n[o]=y(i)}return n}function h(p){if(typeof p!="object"||p===null)return p;if(Array.isArray(p))return g(p,h);if(p.constructor!==Object&&(c=t.get(p.constructor)))return c(p,h);let n={};for(let o in p){let i=p[o];typeof i!="object"||i===null?n[o]=i:i.constructor!==Object&&(c=t.get(i.constructor))?n[o]=c(i,h):ArrayBuffer.isView(i)?n[o]=k(i):n[o]=h(i)}return n}}function we(e){let t=[],c=[],g=new Map;if(g.set(Date,o=>new Date(o)),g.set(Map,(o,i)=>new Map(h(Array.from(o),i))),g.set(Set,(o,i)=>new Set(h(Array.from(o),i))),e.constructorHandlers)for(let o of e.constructorHandlers)g.set(o[0],o[1]);let y=null;return e.proto?n:p;function h(o,i){let a=Object.keys(o),r=new Array(a.length);for(let l=0;l<a.length;l++){let b=a[l],$=o[b];if(typeof $!="object"||$===null)r[b]=$;else if($.constructor!==Object&&(y=g.get($.constructor)))r[b]=y($,i);else if(ArrayBuffer.isView($))r[b]=k($);else{let S=t.indexOf($);S!==-1?r[b]=c[S]:r[b]=i($)}}return r}function p(o){if(typeof o!="object"||o===null)return o;if(Array.isArray(o))return h(o,p);if(o.constructor!==Object&&(y=g.get(o.constructor)))return y(o,p);let i={};t.push(o),c.push(i);for(let a in o){if(Object.hasOwnProperty.call(o,a)===!1)continue;let r=o[a];if(typeof r!="object"||r===null)i[a]=r;else if(r.constructor!==Object&&(y=g.get(r.constructor)))i[a]=y(r,p);else if(ArrayBuffer.isView(r))i[a]=k(r);else{let l=t.indexOf(r);l!==-1?i[a]=c[l]:i[a]=p(r)}}return t.pop(),c.pop(),i}function n(o){if(typeof o!="object"||o===null)return o;if(Array.isArray(o))return h(o,n);if(o.constructor!==Object&&(y=g.get(o.constructor)))return y(o,n);let i={};t.push(o),c.push(i);for(let a in o){let r=o[a];if(typeof r!="object"||r===null)i[a]=r;else if(r.constructor!==Object&&(y=g.get(r.constructor)))i[a]=y(r,n);else if(ArrayBuffer.isView(r))i[a]=k(r);else{let l=t.indexOf(r);l!==-1?i[a]=c[l]:i[a]=n(r)}}return t.pop(),c.pop(),i}}});var se=J((ne,V)=>{(function(e,t){"use strict";typeof V=="object"&&typeof V.exports=="object"?V.exports=t():typeof define=="function"&&define.amd?define([],t):e.objectPath=t()})(ne,function(){"use strict";var e=Object.prototype.toString;function t(a,r){return a==null?!1:Object.prototype.hasOwnProperty.call(a,r)}function c(a){if(!a||h(a)&&a.length===0)return!0;if(typeof a!="string"){for(var r in a)if(t(a,r))return!1;return!0}return!1}function g(a){return e.call(a)}function y(a){return typeof a=="object"&&g(a)==="[object Object]"}var h=Array.isArray||function(a){return e.call(a)==="[object Array]"};function p(a){return typeof a=="boolean"||g(a)==="[object Boolean]"}function n(a){var r=parseInt(a);return r.toString()===a?r:a}function o(a){a=a||{};var r=function(f){return Object.keys(r).reduce(function(s,u){return u==="create"||typeof r[u]=="function"&&(s[u]=r[u].bind(r,f)),s},{})},l;a.includeInheritedProps?l=function(){return!0}:l=function(f,s){return typeof s=="number"&&Array.isArray(f)||t(f,s)};function b(f,s){if(l(f,s))return f[s]}var $;a.includeInheritedProps?$=function(f,s){typeof s!="string"&&typeof s!="number"&&(s=String(s));var u=b(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 b(f,s)};function S(f,s,u,m){if(typeof s=="number"&&(s=[s]),!s||s.length===0)return f;if(typeof s=="string")return S(f,s.split(".").map(n),u,m);var O=s[0],d=$(f,O);return s.length===1?((d===void 0||!m)&&(f[O]=u),d):(d===void 0&&(typeof s[1]=="number"?f[O]=[]:f[O]={}),S(f[O],s.slice(1),u,m))}return r.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 m=n(s[u]);if(typeof m=="number"&&h(f)&&m<f.length||(a.includeInheritedProps?m in Object(f):t(f,m)))f=f[m];else return!1}return!0},r.ensureExists=function(f,s,u){return S(f,s,u,!0)},r.set=function(f,s,u,m){return S(f,s,u,m)},r.insert=function(f,s,u,m){var O=r.get(f,s);m=~~m,h(O)||(O=[],r.set(f,s,O)),O.splice(m,0,u)},r.empty=function(f,s){if(!c(s)&&f!=null){var u,m;if(u=r.get(f,s)){if(typeof u=="string")return r.set(f,s,"");if(p(u))return r.set(f,s,!1);if(typeof u=="number")return r.set(f,s,0);if(h(u))u.length=0;else if(y(u))for(m in u)l(u,m)&&delete u[m];else return r.set(f,s,null)}}},r.push=function(f,s){var u=r.get(f,s);h(u)||(u=[],r.set(f,s,u)),u.push.apply(u,Array.prototype.slice.call(arguments,2))},r.coalesce=function(f,s,u){for(var m,O=0,d=s.length;O<d;O++)if((m=r.get(f,s[O]))!==void 0)return m;return u},r.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 r.get(f,s.split("."),u);var m=n(s[0]),O=$(f,m);return O===void 0?u:s.length===1?O:r.get(f[m],s.slice(1),u)},r.del=function(s,u){if(typeof u=="number"&&(u=[u]),s==null||c(u))return s;if(typeof u=="string")return r.del(s,u.split("."));var m=n(u[0]);if($(s,m),!l(s,m))return s;if(u.length===1)h(s)?s.splice(m,1):delete s[m];else return r.del(s[m],u.slice(1));return s},r}var i=o();return i.create=o,i.withInheritedProps=o({includeInheritedProps:!0}),i})});var ke={};de(ke,{checkTypesMini:()=>Ne,defaults:()=>ue,version:()=>ve});var w=T(Z(),1);var re=T(H(),1);var ee=T(H(),1);var Te=(0,ee.default)();function v(e){if(e==null||typeof e!="object")return!1;let t=Object.getPrototypeOf(e);return t!==null&&t!==Object.prototype&&Object.getPrototypeOf(t)!==null?!1:!(Symbol.iterator in e)&&!(Symbol.toStringTag in e)}function D(e=[],t=[]){return!e||!Array.isArray(e)||!e.length?[]:!t||!Array.isArray(t)||!t.length?e:e.filter(c=>!t.includes(c))}function te(e=[],t=[]){return!e||!t?[]:Array.from(new Set(Array.from(e).filter(c=>new Set(t).has(c))))}function B(e){if(e.includes(".")){let t=e.lastIndexOf(".");if(!e.slice(0,t).includes("."))return e.slice(0,t);for(let c=t-1;c--;)if(e[c]===".")return e.slice(c+1,t)}return null}var _=(0,re.default)();function R(e,t){let c={now:!1};function g(y,h,p,n){let o=_(y),i,a=E({depth:-1,path:""},p);if(a.depth+=1,Array.isArray(o))for(let r=0,l=o.length;r<l&&!n.now;r++){let b=a.path?"".concat(a.path,".").concat(r):"".concat(r);o[r]!==void 0?(a.parent=_(o),a.parentType="array",a.parentKey=B(b),i=g(h(o[r],void 0,j(E({},a),{path:b}),n),h,j(E({},a),{path:b}),n),Number.isNaN(i)&&r<o.length?(o.splice(r,1),r-=1):o[r]=i):o.splice(r,1)}else if(v(o))for(let r in o){if(n.now&&r!=null)break;let l=a.path?"".concat(a.path,".").concat(r):r;a.depth===0&&r!=null&&(a.topmostKey=r),a.parent=_(o),a.parentType="object",a.parentKey=B(l),i=g(h(r,o[r],j(E({},a),{path:l}),n),h,j(E({},a),{path:l}),n),Number.isNaN(i)?delete o[r]:o[r]=i}return o}return g(e,t,{},c)}function F(e){return typeof e!="string"?e:e.length?[e]:[]}var I=T(se(),1);function W(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}var G=new Map,ie=(e,t)=>{if(!Array.isArray(e))switch(typeof e){case"string":{e=[e];break}case"undefined":{e=[];break}default:throw new TypeError("Expected '".concat(t,"' to be a string or an array, but got a type of '").concat(typeof e,"'"))}return e.filter(c=>{if(typeof c!="string"){if(c===void 0)return!1;throw new TypeError("Expected '".concat(t,"' to be an array of strings, but found a type of '").concat(typeof c,"' in the array"))}return!0})},oe,ae,le,Se=(e,t)=>{t=E({caseSensitive:!1},t);let c="s"+(t.caseSensitive?"":"i"),g=e+"|"+c;if(G.has(g))return G.get(g);let y=e[0]==="!";y&&(e=e.slice(1)),e=e.replaceAll(String.raw(oe||(oe=x(["*"],["\\*"]))),"__ESCAPED_STAR__").replaceAll("\\\\","__ESCAPED_BACKSLASH__").replaceAll(/\\(.)/g,"$1"),e=W(e).replaceAll(String.raw(ae||(ae=x(["*"],["\\*"]))),".*"),e=e.replaceAll("__ESCAPED_STAR__",String.raw(le||(le=x(["*"],["\\*"])))).replaceAll("__ESCAPED_BACKSLASH__","\\\\");let h=new RegExp("^".concat(e,"$"),c);return h.negated=y,G.set(g,h),h},Ae=(e,t,c,g)=>{if(e=ie(e,"inputs"),t=ie(t,"patterns"),t.length===0)return[];t=t.map(o=>Se(o,c));let y=t.filter(o=>o.negated),h=t.filter(o=>!o.negated),{allPatterns:p}=c||{},n=[];if(p&&g&&y.length>1&&h.length===0){for(let o of e)for(let i of y)if(i.test(o))return[];return e.slice(0,1)}for(let o of e){let i=!1;for(let a of y)if(a.test(o)){i=!0;break}if(!i){if(h.length===0)n.push(o);else if(p){let a=Array.from({length:h.length},()=>!1);for(let[r,l]of h.entries())l.test(o)&&(a[r]=!0);a.every(Boolean)&&n.push(o)}else{let a=!1;for(let r of h)if(r.test(o)){a=!0;break}a&&n.push(o)}if(g&&n.length>0)break}}return n};function C(e,t,c){return Ae(e,t,c,!0).length>0}var ce="8.0.32";var ve=ce,ue={ignoreKeys:[],ignorePaths:[],acceptArrays:!1,acceptArraysIgnore:[],enforceStrictKeyset:!0,schema:{},msg:"check-types-mini",optsVarName:"opts"};function De(e,t,c){function g(i){return i!=null}function y(i,a){return typeof a=="string"&&(a=F(a)),Array.from(i).filter(r=>!a.some(l=>C(r,l,{caseSensitive:!0})))}let h=Object.prototype.hasOwnProperty,p=["any","anything","every","everything","all","whatever","whatevs"];if(!g(e))throw new Error("check-types-mini: [THROW_ID_01] First argument is missing!");let n=E(E({},ue),c);if(typeof n.ignoreKeys=="string"&&(n.ignoreKeys=[n.ignoreKeys]),typeof n.ignorePaths=="string"&&(n.ignorePaths=[n.ignorePaths]),typeof n.acceptArraysIgnore=="string"&&(n.acceptArraysIgnore=[n.acceptArraysIgnore]),n.msg="".concat(n.msg).trim(),n.msg[n.msg.length-1]===":"&&(n.msg=n.msg.slice(0,n.msg.length-1).trim()),v(n.schema))Object.keys(n.schema).forEach(i=>{if(v(n.schema[i])){let a={};R(n.schema[i],(r,l,b)=>{let $=l!==void 0?l:r;return!Array.isArray($)&&!v($)&&(a["".concat(i,".").concat(b.path)]=$),$}),delete n.schema[i],n.schema=E(E({},n.schema),a)}}),Object.keys(n.schema).forEach(i=>{Array.isArray(n.schema[i])||(n.schema[i]=[n.schema[i]]),n.schema[i]=n.schema[i].map(a=>"".concat(a).toLowerCase().trim())});else if(n.schema!=null)throw new Error("check-types-mini: opts.schema was customised to ".concat(JSON.stringify(n.schema,null,0)," which is not object but ").concat(typeof n.schema));if(g(t)||(t={}),n.enforceStrictKeyset)if(g(n.schema)&&Object.keys(n.schema).length){if(t&&y(D(Object.keys(e),Object.keys(t).concat(Object.keys(n.schema))),n.ignoreKeys).length){let i=D(Object.keys(e),Object.keys(t).concat(Object.keys(n.schema)));throw new TypeError("".concat(n.msg,": ").concat(n.optsVarName,".enforceStrictKeyset is on and the following key").concat(i.length>1?"s":""," ").concat(i.length>1?"are":"is"," not covered by schema and/or reference objects: ").concat(i.join(", ")))}}else if(v(t)&&Object.keys(t).length){if(y(D(Object.keys(e),Object.keys(t)),n.ignoreKeys).length!==0){let i=D(Object.keys(e),Object.keys(t));throw new TypeError("".concat(n.msg,": The input object has key").concat(i.length>1?"s":""," which ").concat(i.length>1?"are":"is"," not covered by the reference object: ").concat(i.join(", ")))}else if(y(D(Object.keys(t),Object.keys(e)),n.ignoreKeys).length!==0){let i=D(Object.keys(t),Object.keys(e));throw new TypeError("".concat(n.msg,": The reference object has key").concat(i.length>1?"s":""," which ").concat(i.length>1?"are":"is"," not present in the input object: ").concat(i.join(", ")))}}else throw new TypeError("".concat(n.msg,": Both ").concat(n.optsVarName,".schema and reference objects are missing! We don't have anything to match the keys as you requested via resolvedOpts.enforceStrictKeyset!"));let o=[];R(e,(i,a,r)=>{let l=a,b=i;if(r.parentType==="array"&&(b=void 0,l=i),Array.isArray(o)&&o.length&&o.some(s=>r.path.startsWith(s))||b&&n.ignoreKeys.some(s=>b&&C(b,s))||n.ignorePaths.some(s=>C(r.path,s)))return l;let $=!(!v(l)&&!Array.isArray(l)&&Array.isArray(r.parent)),S=!1;v(n.schema)&&h.call(n.schema,r.path)&&(S=!0);let f=!1;if(v(t)&&I.default.has(t,r.path)&&(f=!0),n.enforceStrictKeyset&&$&&!S&&!f)throw new TypeError("".concat(n.msg,": ").concat(n.optsVarName,".").concat(r.path," is neither covered by reference object (second input argument), nor ").concat(n.optsVarName,".schema! To stop this error, turn off ").concat(n.optsVarName,".enforceStrictKeyset or provide some type reference (2nd argument or ").concat(n.optsVarName,".schema).\n\nDebug info:\n\nobj = ").concat(JSON.stringify(e,null,4),"\n\nref = ").concat(JSON.stringify(t,null,4),"\n\ninnerObj = ").concat(JSON.stringify(r,null,4),"\n\nresolvedOpts = ").concat(JSON.stringify(n,null,4),"\n\ncurrent = ").concat(JSON.stringify(l,null,4),"\n\n"));if(S){let s=F(n.schema[r.path]).map(u=>"".concat(u).toLowerCase());if(I.default.set(n.schema,r.path,s),te(s,p).length)o.push(r.path);else if(l!==!0&&l!==!1&&!s.includes((0,w.default)(l).toLowerCase())||(l===!0||l===!1)&&!s.includes(String(l))&&!s.includes("boolean"))if(Array.isArray(l)&&n.acceptArrays){for(let u=0,m=l.length;u<m;u++)if(!s.includes((0,w.default)(l[u]).toLowerCase()))throw new TypeError("".concat(n.msg,": ").concat(n.optsVarName,".").concat(r.path,".").concat(u,", the ").concat(u,"th element (equal to ").concat(JSON.stringify(l[u],null,0),") is of a type ").concat((0,w.default)(l[u]).toLowerCase(),", but only the following are allowed by the ").concat(n.optsVarName,".schema: ").concat(s.join(", ")))}else throw new TypeError("".concat(n.msg,": ").concat(n.optsVarName,".").concat(r.path," was customised to ").concat((0,w.default)(l)!=="string"?'"':"").concat(JSON.stringify(l,null,0)).concat((0,w.default)(l)!=="string"?'"':""," (type: ").concat((0,w.default)(l).toLowerCase(),") which is not among the allowed types in schema (which is equal to ").concat(JSON.stringify(s,null,0),")"))}else if(t&&v(t)&&f){let s=I.default.get(t,r.path);if(n.acceptArrays&&Array.isArray(l)&&!n.acceptArraysIgnore.includes(i)){if(!l.every(m=>(0,w.default)(m).toLowerCase()===(0,w.default)(t[i]).toLowerCase()))throw new TypeError("".concat(n.msg,": ").concat(n.optsVarName,".").concat(r.path," was customised to be array, but not all of its elements are ").concat((0,w.default)(t[i]).toLowerCase(),"-type"))}else if((0,w.default)(l)!==(0,w.default)(s))throw new TypeError("".concat(n.msg,": ").concat(n.optsVarName,".").concat(r.path," was customised to ").concat((0,w.default)(l).toLowerCase()==="string"?"":'"').concat(JSON.stringify(l,null,0)).concat((0,w.default)(l).toLowerCase()==="string"?"":'"'," which is not ").concat((0,w.default)(s).toLowerCase()," but ").concat((0,w.default)(l).toLowerCase()))}return l})}function Ne(e,t,c){De(e,t,c)}return be(ke);})();
|
|
10
|
+
"use strict";var checkTypesMini=(()=>{var fe=Object.create,U=Object.freeze,N=Object.defineProperty,pe=Object.defineProperties,ye=Object.getOwnPropertyDescriptor,ge=Object.getOwnPropertyDescriptors,me=Object.getOwnPropertyNames,Q=Object.getOwnPropertySymbols,he=Object.getPrototypeOf,Y=Object.prototype.hasOwnProperty,$e=Object.prototype.propertyIsEnumerable;var q=(e,t,c)=>t in e?N(e,t,{enumerable:!0,configurable:!0,writable:!0,value:c}):e[t]=c,E=(e,t)=>{for(var c in t||(t={}))Y.call(t,c)&&q(e,c,t[c]);if(Q)for(var c of Q(t))$e.call(t,c)&&q(e,c,t[c]);return e},j=(e,t)=>pe(e,ge(t));var J=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),de=(e,t)=>{for(var c in t)N(e,c,{get:t[c],enumerable:!0})},z=(e,t,c,g)=>{if(t&&typeof t=="object"||typeof t=="function")for(let y of me(t))!Y.call(e,y)&&y!==c&&N(e,y,{get:()=>t[y],enumerable:!(g=ye(t,y))||g.enumerable});return e};var T=(e,t,c)=>(c=e!=null?fe(he(e)):{},z(t||!e||!e.__esModule?N(c,"default",{value:e,enumerable:!0}):c,e)),be=e=>z(N({},"__esModule",{value:!0}),e);var x=(e,t)=>U(N(e,"raw",{value:U(t||e.slice())}));var Z=J((K,M)=>{(function(e,t){typeof K=="object"&&typeof M<"u"?M.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof globalThis<"u"?globalThis:e||self,e.typeDetect=t())})(K,(function(){"use strict";var e=typeof Promise=="function",t=(function(d){if(typeof globalThis=="object")return globalThis;Object.defineProperty(d,"typeDetectGlobalObject",{get:function(){return this},configurable:!0});var P=typeDetectGlobalObject;return delete d.typeDetectGlobalObject,P})(Object.prototype),c=typeof Symbol<"u",g=typeof Map<"u",y=typeof Set<"u",h=typeof WeakMap<"u",p=typeof WeakSet<"u",n=typeof DataView<"u",o=c&&typeof Symbol.iterator<"u",i=c&&typeof Symbol.toStringTag<"u",a=y&&typeof Set.prototype.entries=="function",r=g&&typeof Map.prototype.entries=="function",l=a&&Object.getPrototypeOf(new Set().entries()),b=r&&Object.getPrototypeOf(new Map().entries()),$=o&&typeof Array.prototype[Symbol.iterator]=="function",S=$&&Object.getPrototypeOf([][Symbol.iterator]()),f=o&&typeof String.prototype[Symbol.iterator]=="function",s=f&&Object.getPrototypeOf(""[Symbol.iterator]()),u=8,m=-1;function O(d){var P=typeof d;if(P!=="object")return P;if(d===null)return"null";if(d===t)return"global";if(Array.isArray(d)&&(i===!1||!(Symbol.toStringTag in d)))return"Array";if(typeof window=="object"&&window!==null){if(typeof window.location=="object"&&d===window.location)return"Location";if(typeof window.document=="object"&&d===window.document)return"Document";if(typeof window.navigator=="object"){if(typeof window.navigator.mimeTypes=="object"&&d===window.navigator.mimeTypes)return"MimeTypeArray";if(typeof window.navigator.plugins=="object"&&d===window.navigator.plugins)return"PluginArray"}if((typeof window.HTMLElement=="function"||typeof window.HTMLElement=="object")&&d instanceof window.HTMLElement){if(d.tagName==="BLOCKQUOTE")return"HTMLQuoteElement";if(d.tagName==="TD")return"HTMLTableDataCellElement";if(d.tagName==="TH")return"HTMLTableHeaderCellElement"}}var L=i&&d[Symbol.toStringTag];if(typeof L=="string")return L;var A=Object.getPrototypeOf(d);return A===RegExp.prototype?"RegExp":A===Date.prototype?"Date":e&&A===Promise.prototype?"Promise":y&&A===Set.prototype?"Set":g&&A===Map.prototype?"Map":p&&A===WeakSet.prototype?"WeakSet":h&&A===WeakMap.prototype?"WeakMap":n&&A===DataView.prototype?"DataView":g&&A===b?"Map Iterator":y&&A===l?"Set Iterator":$&&A===S?"Array Iterator":f&&A===s?"String Iterator":A===null?"Object":Object.prototype.toString.call(d).slice(u,m)}return O}))});var H=J((Pe,X)=>{"use strict";X.exports=Oe;function k(e){return e instanceof Buffer?Buffer.from(e):new e.constructor(e.buffer.slice(),e.byteOffset,e.length)}function Oe(e){if(e=e||{},e.circles)return we(e);let t=new Map;if(t.set(Date,p=>new Date(p)),t.set(Map,(p,n)=>new Map(g(Array.from(p),n))),t.set(Set,(p,n)=>new Set(g(Array.from(p),n))),e.constructorHandlers)for(let p of e.constructorHandlers)t.set(p[0],p[1]);let c=null;return e.proto?h:y;function g(p,n){let o=Object.keys(p),i=new Array(o.length);for(let a=0;a<o.length;a++){let r=o[a],l=p[r];typeof l!="object"||l===null?i[r]=l:l.constructor!==Object&&(c=t.get(l.constructor))?i[r]=c(l,n):ArrayBuffer.isView(l)?i[r]=k(l):i[r]=n(l)}return i}function y(p){if(typeof p!="object"||p===null)return p;if(Array.isArray(p))return g(p,y);if(p.constructor!==Object&&(c=t.get(p.constructor)))return c(p,y);let n={};for(let o in p){if(Object.hasOwnProperty.call(p,o)===!1)continue;let i=p[o];typeof i!="object"||i===null?n[o]=i:i.constructor!==Object&&(c=t.get(i.constructor))?n[o]=c(i,y):ArrayBuffer.isView(i)?n[o]=k(i):n[o]=y(i)}return n}function h(p){if(typeof p!="object"||p===null)return p;if(Array.isArray(p))return g(p,h);if(p.constructor!==Object&&(c=t.get(p.constructor)))return c(p,h);let n={};for(let o in p){let i=p[o];typeof i!="object"||i===null?n[o]=i:i.constructor!==Object&&(c=t.get(i.constructor))?n[o]=c(i,h):ArrayBuffer.isView(i)?n[o]=k(i):n[o]=h(i)}return n}}function we(e){let t=[],c=[],g=new Map;if(g.set(Date,o=>new Date(o)),g.set(Map,(o,i)=>new Map(h(Array.from(o),i))),g.set(Set,(o,i)=>new Set(h(Array.from(o),i))),e.constructorHandlers)for(let o of e.constructorHandlers)g.set(o[0],o[1]);let y=null;return e.proto?n:p;function h(o,i){let a=Object.keys(o),r=new Array(a.length);for(let l=0;l<a.length;l++){let b=a[l],$=o[b];if(typeof $!="object"||$===null)r[b]=$;else if($.constructor!==Object&&(y=g.get($.constructor)))r[b]=y($,i);else if(ArrayBuffer.isView($))r[b]=k($);else{let S=t.indexOf($);S!==-1?r[b]=c[S]:r[b]=i($)}}return r}function p(o){if(typeof o!="object"||o===null)return o;if(Array.isArray(o))return h(o,p);if(o.constructor!==Object&&(y=g.get(o.constructor)))return y(o,p);let i={};t.push(o),c.push(i);for(let a in o){if(Object.hasOwnProperty.call(o,a)===!1)continue;let r=o[a];if(typeof r!="object"||r===null)i[a]=r;else if(r.constructor!==Object&&(y=g.get(r.constructor)))i[a]=y(r,p);else if(ArrayBuffer.isView(r))i[a]=k(r);else{let l=t.indexOf(r);l!==-1?i[a]=c[l]:i[a]=p(r)}}return t.pop(),c.pop(),i}function n(o){if(typeof o!="object"||o===null)return o;if(Array.isArray(o))return h(o,n);if(o.constructor!==Object&&(y=g.get(o.constructor)))return y(o,n);let i={};t.push(o),c.push(i);for(let a in o){let r=o[a];if(typeof r!="object"||r===null)i[a]=r;else if(r.constructor!==Object&&(y=g.get(r.constructor)))i[a]=y(r,n);else if(ArrayBuffer.isView(r))i[a]=k(r);else{let l=t.indexOf(r);l!==-1?i[a]=c[l]:i[a]=n(r)}}return t.pop(),c.pop(),i}}});var se=J((ne,V)=>{(function(e,t){"use strict";typeof V=="object"&&typeof V.exports=="object"?V.exports=t():typeof define=="function"&&define.amd?define([],t):e.objectPath=t()})(ne,function(){"use strict";var e=Object.prototype.toString;function t(a,r){return a==null?!1:Object.prototype.hasOwnProperty.call(a,r)}function c(a){if(!a||h(a)&&a.length===0)return!0;if(typeof a!="string"){for(var r in a)if(t(a,r))return!1;return!0}return!1}function g(a){return e.call(a)}function y(a){return typeof a=="object"&&g(a)==="[object Object]"}var h=Array.isArray||function(a){return e.call(a)==="[object Array]"};function p(a){return typeof a=="boolean"||g(a)==="[object Boolean]"}function n(a){var r=parseInt(a);return r.toString()===a?r:a}function o(a){a=a||{};var r=function(f){return Object.keys(r).reduce(function(s,u){return u==="create"||typeof r[u]=="function"&&(s[u]=r[u].bind(r,f)),s},{})},l;a.includeInheritedProps?l=function(){return!0}:l=function(f,s){return typeof s=="number"&&Array.isArray(f)||t(f,s)};function b(f,s){if(l(f,s))return f[s]}var $;a.includeInheritedProps?$=function(f,s){typeof s!="string"&&typeof s!="number"&&(s=String(s));var u=b(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 b(f,s)};function S(f,s,u,m){if(typeof s=="number"&&(s=[s]),!s||s.length===0)return f;if(typeof s=="string")return S(f,s.split(".").map(n),u,m);var O=s[0],d=$(f,O);return s.length===1?((d===void 0||!m)&&(f[O]=u),d):(d===void 0&&(typeof s[1]=="number"?f[O]=[]:f[O]={}),S(f[O],s.slice(1),u,m))}return r.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 m=n(s[u]);if(typeof m=="number"&&h(f)&&m<f.length||(a.includeInheritedProps?m in Object(f):t(f,m)))f=f[m];else return!1}return!0},r.ensureExists=function(f,s,u){return S(f,s,u,!0)},r.set=function(f,s,u,m){return S(f,s,u,m)},r.insert=function(f,s,u,m){var O=r.get(f,s);m=~~m,h(O)||(O=[],r.set(f,s,O)),O.splice(m,0,u)},r.empty=function(f,s){if(!c(s)&&f!=null){var u,m;if(u=r.get(f,s)){if(typeof u=="string")return r.set(f,s,"");if(p(u))return r.set(f,s,!1);if(typeof u=="number")return r.set(f,s,0);if(h(u))u.length=0;else if(y(u))for(m in u)l(u,m)&&delete u[m];else return r.set(f,s,null)}}},r.push=function(f,s){var u=r.get(f,s);h(u)||(u=[],r.set(f,s,u)),u.push.apply(u,Array.prototype.slice.call(arguments,2))},r.coalesce=function(f,s,u){for(var m,O=0,d=s.length;O<d;O++)if((m=r.get(f,s[O]))!==void 0)return m;return u},r.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 r.get(f,s.split("."),u);var m=n(s[0]),O=$(f,m);return O===void 0?u:s.length===1?O:r.get(f[m],s.slice(1),u)},r.del=function(s,u){if(typeof u=="number"&&(u=[u]),s==null||c(u))return s;if(typeof u=="string")return r.del(s,u.split("."));var m=n(u[0]);if($(s,m),!l(s,m))return s;if(u.length===1)h(s)?s.splice(m,1):delete s[m];else return r.del(s[m],u.slice(1));return s},r}var i=o();return i.create=o,i.withInheritedProps=o({includeInheritedProps:!0}),i})});var ke={};de(ke,{checkTypesMini:()=>Ne,defaults:()=>ue,version:()=>ve});var w=T(Z(),1);var re=T(H(),1);var ee=T(H(),1);var Te=(0,ee.default)();function v(e){if(e==null||typeof e!="object")return!1;let t=Object.getPrototypeOf(e);return t!==null&&t!==Object.prototype&&Object.getPrototypeOf(t)!==null?!1:!(Symbol.iterator in e)&&!(Symbol.toStringTag in e)}function D(e=[],t=[]){return!e||!Array.isArray(e)||!e.length?[]:!t||!Array.isArray(t)||!t.length?e:e.filter(c=>!t.includes(c))}function te(e=[],t=[]){return!e||!t?[]:Array.from(new Set(Array.from(e).filter(c=>new Set(t).has(c))))}function B(e){if(e.includes(".")){let t=e.lastIndexOf(".");if(!e.slice(0,t).includes("."))return e.slice(0,t);for(let c=t-1;c--;)if(e[c]===".")return e.slice(c+1,t)}return null}var _=(0,re.default)();function R(e,t){let c={now:!1};function g(y,h,p,n){let o=_(y),i,a=E({depth:-1,path:""},p);if(a.depth+=1,Array.isArray(o))for(let r=0,l=o.length;r<l&&!n.now;r++){let b=a.path?"".concat(a.path,".").concat(r):"".concat(r);o[r]!==void 0?(a.parent=_(o),a.parentType="array",a.parentKey=B(b),i=g(h(o[r],void 0,j(E({},a),{path:b}),n),h,j(E({},a),{path:b}),n),Number.isNaN(i)&&r<o.length?(o.splice(r,1),r-=1):o[r]=i):o.splice(r,1)}else if(v(o))for(let r in o){if(n.now&&r!=null)break;let l=a.path?"".concat(a.path,".").concat(r):r;a.depth===0&&r!=null&&(a.topmostKey=r),a.parent=_(o),a.parentType="object",a.parentKey=B(l),i=g(h(r,o[r],j(E({},a),{path:l}),n),h,j(E({},a),{path:l}),n),Number.isNaN(i)?delete o[r]:o[r]=i}return o}return g(e,t,{},c)}function F(e){return typeof e!="string"?e:e.length?[e]:[]}var I=T(se(),1);function W(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}var G=new Map,ie=(e,t)=>{if(!Array.isArray(e))switch(typeof e){case"string":{e=[e];break}case"undefined":{e=[];break}default:throw new TypeError("Expected '".concat(t,"' to be a string or an array, but got a type of '").concat(typeof e,"'"))}return e.filter(c=>{if(typeof c!="string"){if(c===void 0)return!1;throw new TypeError("Expected '".concat(t,"' to be an array of strings, but found a type of '").concat(typeof c,"' in the array"))}return!0})},oe,ae,le,Se=(e,t)=>{t=E({caseSensitive:!1},t);let c="s"+(t.caseSensitive?"":"i"),g=e+"|"+c;if(G.has(g))return G.get(g);let y=e[0]==="!";y&&(e=e.slice(1)),e=e.replaceAll(String.raw(oe||(oe=x(["*"],["\\*"]))),"__ESCAPED_STAR__").replaceAll("\\\\","__ESCAPED_BACKSLASH__").replaceAll(/\\(.)/g,"$1"),e=W(e).replaceAll(String.raw(ae||(ae=x(["*"],["\\*"]))),".*"),e=e.replaceAll("__ESCAPED_STAR__",String.raw(le||(le=x(["*"],["\\*"])))).replaceAll("__ESCAPED_BACKSLASH__","\\\\");let h=new RegExp("^".concat(e,"$"),c);return h.negated=y,G.set(g,h),h},Ae=(e,t,c,g)=>{if(e=ie(e,"inputs"),t=ie(t,"patterns"),t.length===0)return[];t=t.map(o=>Se(o,c));let y=t.filter(o=>o.negated),h=t.filter(o=>!o.negated),{allPatterns:p}=c||{},n=[];if(p&&g&&y.length>1&&h.length===0){for(let o of e)for(let i of y)if(i.test(o))return[];return e.slice(0,1)}for(let o of e){let i=!1;for(let a of y)if(a.test(o)){i=!0;break}if(!i){if(h.length===0)n.push(o);else if(p){let a=Array.from({length:h.length},()=>!1);for(let[r,l]of h.entries())l.test(o)&&(a[r]=!0);a.every(Boolean)&&n.push(o)}else{let a=!1;for(let r of h)if(r.test(o)){a=!0;break}a&&n.push(o)}if(g&&n.length>0)break}}return n};function C(e,t,c){return Ae(e,t,c,!0).length>0}var ce="8.0.34";var ve=ce,ue={ignoreKeys:[],ignorePaths:[],acceptArrays:!1,acceptArraysIgnore:[],enforceStrictKeyset:!0,schema:{},msg:"check-types-mini",optsVarName:"opts"};function De(e,t,c){function g(i){return i!=null}function y(i,a){return typeof a=="string"&&(a=F(a)),Array.from(i).filter(r=>!a.some(l=>C(r,l,{caseSensitive:!0})))}let h=Object.prototype.hasOwnProperty,p=["any","anything","every","everything","all","whatever","whatevs"];if(!g(e))throw new Error("check-types-mini: [THROW_ID_01] First argument is missing!");let n=E(E({},ue),c);if(typeof n.ignoreKeys=="string"&&(n.ignoreKeys=[n.ignoreKeys]),typeof n.ignorePaths=="string"&&(n.ignorePaths=[n.ignorePaths]),typeof n.acceptArraysIgnore=="string"&&(n.acceptArraysIgnore=[n.acceptArraysIgnore]),n.msg="".concat(n.msg).trim(),n.msg[n.msg.length-1]===":"&&(n.msg=n.msg.slice(0,n.msg.length-1).trim()),v(n.schema))Object.keys(n.schema).forEach(i=>{if(v(n.schema[i])){let a={};R(n.schema[i],(r,l,b)=>{let $=l!==void 0?l:r;return!Array.isArray($)&&!v($)&&(a["".concat(i,".").concat(b.path)]=$),$}),delete n.schema[i],n.schema=E(E({},n.schema),a)}}),Object.keys(n.schema).forEach(i=>{Array.isArray(n.schema[i])||(n.schema[i]=[n.schema[i]]),n.schema[i]=n.schema[i].map(a=>"".concat(a).toLowerCase().trim())});else if(n.schema!=null)throw new Error("check-types-mini: opts.schema was customised to ".concat(JSON.stringify(n.schema,null,0)," which is not object but ").concat(typeof n.schema));if(g(t)||(t={}),n.enforceStrictKeyset)if(g(n.schema)&&Object.keys(n.schema).length){if(t&&y(D(Object.keys(e),Object.keys(t).concat(Object.keys(n.schema))),n.ignoreKeys).length){let i=D(Object.keys(e),Object.keys(t).concat(Object.keys(n.schema)));throw new TypeError("".concat(n.msg,": ").concat(n.optsVarName,".enforceStrictKeyset is on and the following key").concat(i.length>1?"s":""," ").concat(i.length>1?"are":"is"," not covered by schema and/or reference objects: ").concat(i.join(", ")))}}else if(v(t)&&Object.keys(t).length){if(y(D(Object.keys(e),Object.keys(t)),n.ignoreKeys).length!==0){let i=D(Object.keys(e),Object.keys(t));throw new TypeError("".concat(n.msg,": The input object has key").concat(i.length>1?"s":""," which ").concat(i.length>1?"are":"is"," not covered by the reference object: ").concat(i.join(", ")))}else if(y(D(Object.keys(t),Object.keys(e)),n.ignoreKeys).length!==0){let i=D(Object.keys(t),Object.keys(e));throw new TypeError("".concat(n.msg,": The reference object has key").concat(i.length>1?"s":""," which ").concat(i.length>1?"are":"is"," not present in the input object: ").concat(i.join(", ")))}}else throw new TypeError("".concat(n.msg,": Both ").concat(n.optsVarName,".schema and reference objects are missing! We don't have anything to match the keys as you requested via resolvedOpts.enforceStrictKeyset!"));let o=[];R(e,(i,a,r)=>{let l=a,b=i;if(r.parentType==="array"&&(b=void 0,l=i),Array.isArray(o)&&o.length&&o.some(s=>r.path.startsWith(s))||b&&n.ignoreKeys.some(s=>b&&C(b,s))||n.ignorePaths.some(s=>C(r.path,s)))return l;let $=!(!v(l)&&!Array.isArray(l)&&Array.isArray(r.parent)),S=!1;v(n.schema)&&h.call(n.schema,r.path)&&(S=!0);let f=!1;if(v(t)&&I.default.has(t,r.path)&&(f=!0),n.enforceStrictKeyset&&$&&!S&&!f)throw new TypeError("".concat(n.msg,": ").concat(n.optsVarName,".").concat(r.path," is neither covered by reference object (second input argument), nor ").concat(n.optsVarName,".schema! To stop this error, turn off ").concat(n.optsVarName,".enforceStrictKeyset or provide some type reference (2nd argument or ").concat(n.optsVarName,".schema).\n\nDebug info:\n\nobj = ").concat(JSON.stringify(e,null,4),"\n\nref = ").concat(JSON.stringify(t,null,4),"\n\ninnerObj = ").concat(JSON.stringify(r,null,4),"\n\nresolvedOpts = ").concat(JSON.stringify(n,null,4),"\n\ncurrent = ").concat(JSON.stringify(l,null,4),"\n\n"));if(S){let s=F(n.schema[r.path]).map(u=>"".concat(u).toLowerCase());if(I.default.set(n.schema,r.path,s),te(s,p).length)o.push(r.path);else if(l!==!0&&l!==!1&&!s.includes((0,w.default)(l).toLowerCase())||(l===!0||l===!1)&&!s.includes(String(l))&&!s.includes("boolean"))if(Array.isArray(l)&&n.acceptArrays){for(let u=0,m=l.length;u<m;u++)if(!s.includes((0,w.default)(l[u]).toLowerCase()))throw new TypeError("".concat(n.msg,": ").concat(n.optsVarName,".").concat(r.path,".").concat(u,", the ").concat(u,"th element (equal to ").concat(JSON.stringify(l[u],null,0),") is of a type ").concat((0,w.default)(l[u]).toLowerCase(),", but only the following are allowed by the ").concat(n.optsVarName,".schema: ").concat(s.join(", ")))}else throw new TypeError("".concat(n.msg,": ").concat(n.optsVarName,".").concat(r.path," was customised to ").concat((0,w.default)(l)!=="string"?'"':"").concat(JSON.stringify(l,null,0)).concat((0,w.default)(l)!=="string"?'"':""," (type: ").concat((0,w.default)(l).toLowerCase(),") which is not among the allowed types in schema (which is equal to ").concat(JSON.stringify(s,null,0),")"))}else if(t&&v(t)&&f){let s=I.default.get(t,r.path);if(n.acceptArrays&&Array.isArray(l)&&!n.acceptArraysIgnore.includes(i)){if(!l.every(m=>(0,w.default)(m).toLowerCase()===(0,w.default)(t[i]).toLowerCase()))throw new TypeError("".concat(n.msg,": ").concat(n.optsVarName,".").concat(r.path," was customised to be array, but not all of its elements are ").concat((0,w.default)(t[i]).toLowerCase(),"-type"))}else if((0,w.default)(l)!==(0,w.default)(s))throw new TypeError("".concat(n.msg,": ").concat(n.optsVarName,".").concat(r.path," was customised to ").concat((0,w.default)(l).toLowerCase()==="string"?"":'"').concat(JSON.stringify(l,null,0)).concat((0,w.default)(l).toLowerCase()==="string"?"":'"'," which is not ").concat((0,w.default)(s).toLowerCase()," but ").concat((0,w.default)(l).toLowerCase()))}return l})}function Ne(e,t,c){De(e,t,c)}return be(ke);})();
|
|
11
11
|
/**
|
|
12
12
|
* @name codsen-utils
|
|
13
13
|
* @fileoverview Various utility functions
|
|
14
|
-
* @version 1.6.
|
|
15
|
-
* @author Roy Revelt
|
|
14
|
+
* @version 1.6.19
|
|
15
|
+
* @author Roy Revelt
|
|
16
16
|
* @license MIT
|
|
17
17
|
* {@link https://codsen.com/os/codsen-utils/}
|
|
18
18
|
*/
|
|
19
19
|
/**
|
|
20
20
|
* @name ast-monkey-util
|
|
21
21
|
* @fileoverview Utility library of AST helper functions
|
|
22
|
-
* @version 3.0.
|
|
23
|
-
* @author Roy Revelt
|
|
22
|
+
* @version 3.0.21
|
|
23
|
+
* @author Roy Revelt
|
|
24
24
|
* @license MIT
|
|
25
25
|
* {@link https://codsen.com/os/ast-monkey-util/}
|
|
26
26
|
*/
|
|
27
27
|
/**
|
|
28
28
|
* @name ast-monkey-traverse
|
|
29
29
|
* @fileoverview Utility library to traverse AST
|
|
30
|
-
* @version 4.0.
|
|
31
|
-
* @author Roy Revelt
|
|
30
|
+
* @version 4.0.31
|
|
31
|
+
* @author Roy Revelt
|
|
32
32
|
* @license MIT
|
|
33
33
|
* {@link https://codsen.com/os/ast-monkey-traverse/}
|
|
34
34
|
*/
|
|
35
35
|
/**
|
|
36
36
|
* @name arrayiffy-if-string
|
|
37
37
|
* @fileoverview Put non-empty strings into arrays, turn empty-ones into empty arrays. Bypass everything else.
|
|
38
|
-
* @version 5.0.
|
|
39
|
-
* @author Roy Revelt
|
|
38
|
+
* @version 5.0.21
|
|
39
|
+
* @author Roy Revelt
|
|
40
40
|
* @license MIT
|
|
41
41
|
* {@link https://codsen.com/os/arrayiffy-if-string/}
|
|
42
42
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "check-types-mini",
|
|
3
|
-
"version": "8.0.
|
|
3
|
+
"version": "8.0.34",
|
|
4
4
|
"description": "Validate options object",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"compare",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"examples": "node '../../ops/scripts/run-examples.js'",
|
|
46
46
|
"lect": "node '../../ops/lect/lect.js' && npm run prettier -- 'README.md' '.all-contributorsrc' 'rollup.config.js' --write",
|
|
47
47
|
"letspublish": "npm publish --provenance || :",
|
|
48
|
-
"lint": "eslint . --fix",
|
|
48
|
+
"lint": "eslint . --fix --concurrency=auto --cache",
|
|
49
49
|
"perf": "node perf/check.js",
|
|
50
50
|
"prep": "echo 'ready'",
|
|
51
51
|
"prettier": "prettier",
|
|
@@ -72,9 +72,9 @@
|
|
|
72
72
|
}
|
|
73
73
|
},
|
|
74
74
|
"dependencies": {
|
|
75
|
-
"arrayiffy-if-string": "^5.0.
|
|
76
|
-
"ast-monkey-traverse": "^4.0.
|
|
77
|
-
"codsen-utils": "^1.6.
|
|
75
|
+
"arrayiffy-if-string": "^5.0.21",
|
|
76
|
+
"ast-monkey-traverse": "^4.0.31",
|
|
77
|
+
"codsen-utils": "^1.6.19",
|
|
78
78
|
"matcher": "^6.0.0",
|
|
79
79
|
"object-path": "^0.11.8",
|
|
80
80
|
"type-detect": "^4.1.0"
|