New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

check-types-mini

Package Overview
Dependencies
Maintainers
1
Versions
198
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

check-types-mini - npm Package Compare versions

Comparing version 6.1.0 to 7.0.0

10

CHANGELOG.md

@@ -6,2 +6,12 @@ # Change Log

## 7.0.0 (2021-09-09)
### Features
- migrate to ES Modules ([8c9d95d](https://github.com/codsen/codsen/commit/8c9d95d5dea0b769c2f070397141918a4893d575))
### BREAKING CHANGES
- programs now are in ES Modules and won't work with Common JS require()
## 6.1.0 (2021-05-24)

@@ -8,0 +18,0 @@

2

dist/check-types-mini.esm.js
/**
* @name check-types-mini
* @fileoverview Validate options object
* @version 6.1.0
* @version 7.0.0
* @author Roy Revelt, Codsen Ltd

@@ -6,0 +6,0 @@ * @license MIT

/**
* @name check-types-mini
* @fileoverview Validate options object
* @version 6.1.0
* @version 7.0.0
* @author Roy Revelt, Codsen Ltd

@@ -14,3 +14,3 @@ * @license MIT

* @fileoverview Utility library of AST helper functions
* @version 1.4.0
* @version 2.0.0
* @author Roy Revelt, Codsen Ltd

@@ -23,3 +23,3 @@ * @license MIT

* @fileoverview Utility library to traverse AST
* @version 2.1.0
* @version 3.0.0
* @author Roy Revelt, Codsen Ltd

@@ -32,6 +32,6 @@ * @license MIT

* @fileoverview Put non-empty strings into arrays, turn empty-ones into empty arrays. Bypass everything else.
* @version 3.14.0
* @version 4.0.0
* @author Roy Revelt, Codsen Ltd
* @license MIT
* {@link https://codsen.com/os/arrayiffy-if-string/}
*/function ut(t){return"string"==typeof t?t.length?[t]:[]:t}var st={exports:{}};!function(t){t.exports=function(){var t=Object.prototype.toString;function e(t,e){return null!=t&&Object.prototype.hasOwnProperty.call(t,e)}function r(t){if(!t)return!0;if(i(t)&&0===t.length)return!0;if("string"!=typeof t){for(var r in t)if(e(t,r))return!1;return!0}return!1}function n(e){return t.call(e)}function o(t){return"object"==typeof t&&"[object Object]"===n(t)}var i=Array.isArray||function(e){return"[object Array]"===t.call(e)};function a(t){return"boolean"==typeof t||"[object Boolean]"===n(t)}function c(t){var e=parseInt(t);return e.toString()===t?e:t}function u(t){var n,u=function(t){return Object.keys(u).reduce((function(e,r){return"create"===r||"function"==typeof u[r]&&(e[r]=u[r].bind(u,t)),e}),{})};function s(t,e){if(n(t,e))return t[e]}function f(e,r,n,o){if("number"==typeof r&&(r=[r]),!r||0===r.length)return e;if("string"==typeof r)return f(e,r.split(".").map(c),n,o);var i=r[0],a=s(e,i);if(t.includeInheritedProps&&("__proto__"===i||"constructor"===i&&"function"==typeof a))throw new Error("For security reasons, object's magic properties cannot be set");return 1===r.length?(void 0!==a&&o||(e[i]=n),a):(void 0===a&&(e[i]="number"==typeof r[1]?[]:{}),f(e[i],r.slice(1),n,o))}return n=(t=t||{}).includeInheritedProps?function(){return!0}:function(t,r){return"number"==typeof r&&Array.isArray(t)||e(t,r)},u.has=function(r,n){if("number"==typeof n?n=[n]:"string"==typeof n&&(n=n.split(".")),!n||0===n.length)return!!r;for(var o=0;o<n.length;o++){var a=c(n[o]);if(!("number"==typeof a&&i(r)&&a<r.length||(t.includeInheritedProps?a in Object(r):e(r,a))))return!1;r=r[a]}return!0},u.ensureExists=function(t,e,r){return f(t,e,r,!0)},u.set=function(t,e,r,n){return f(t,e,r,n)},u.insert=function(t,e,r,n){var o=u.get(t,e);n=~~n,i(o)||u.set(t,e,o=[]),o.splice(n,0,r)},u.empty=function(t,e){var c,s;if(!r(e)&&null!=t&&(c=u.get(t,e))){if("string"==typeof c)return u.set(t,e,"");if(a(c))return u.set(t,e,!1);if("number"==typeof c)return u.set(t,e,0);if(i(c))c.length=0;else{if(!o(c))return u.set(t,e,null);for(s in c)n(c,s)&&delete c[s]}}},u.push=function(t,e){var r=u.get(t,e);i(r)||u.set(t,e,r=[]),r.push.apply(r,Array.prototype.slice.call(arguments,2))},u.coalesce=function(t,e,r){for(var n,o=0,i=e.length;o<i;o++)if(void 0!==(n=u.get(t,e[o])))return n;return r},u.get=function(t,e,r){if("number"==typeof e&&(e=[e]),!e||0===e.length)return t;if(null==t)return r;if("string"==typeof e)return u.get(t,e.split("."),r);var n=c(e[0]),o=s(t,n);return void 0===o?r:1===e.length?o:u.get(t[n],e.slice(1),r)},u.del=function(t,e){if("number"==typeof e&&(e=[e]),null==t)return t;if(r(e))return t;if("string"==typeof e)return u.del(t,e.split("."));var o=c(e[0]);return n(t,o)?1!==e.length?u.del(t[o],e.slice(1)):(i(t)?t.splice(o,1):delete t[o],t):t},u}var s=u();return s.create=u,s.withInheritedProps=u({includeInheritedProps:!0}),s}()}(st);var ft=st.exports,pt={exports:{}};const lt=t=>{if("string"!=typeof t)throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")},yt=new Map;function ht(t,e){if(!Array.isArray(t))switch(typeof t){case"string":t=[t];break;case"undefined":t=[];break;default:throw new TypeError(`Expected '${e}' to be a string or an array, but got a type of '${typeof t}'`)}return t.filter((t=>{if("string"!=typeof t){if(void 0===t)return!1;throw new TypeError(`Expected '${e}' to be an array of strings, but found a type of '${typeof t}' in the array`)}return!0}))}function gt(t,e){e={caseSensitive:!1,...e};const r=t+JSON.stringify(e);if(yt.has(r))return yt.get(r);const n="!"===t[0];n&&(t=t.slice(1)),t=lt(t).replace(/\\\*/g,"[\\s\\S]*");const o=new RegExp(`^${t}$`,e.caseSensitive?"":"i");return o.negated=n,yt.set(r,o),o}pt.exports=(t,e,r)=>{if(t=ht(t,"inputs"),0===(e=ht(e,"patterns")).length)return[];const n="!"===e[0][0];e=e.map((t=>gt(t,r)));const o=[];for(const r of t){let t=n;for(const n of e)n.test(r)&&(t=!n.negated);t&&o.push(r)}return o},pt.exports.isMatch=(t,e,r)=>(t=ht(t,"inputs"),0!==(e=ht(e,"patterns")).length&&t.some((t=>e.every((e=>{const n=gt(e,r),o=n.test(t);return n.negated?!o:o})))));var dt=pt.exports;const bt={ignoreKeys:[],ignorePaths:[],acceptArrays:!1,acceptArraysIgnore:[],enforceStrictKeyset:!0,schema:{},msg:"check-types-mini",optsVarName:"opts"};t.checkTypesMini=function(t,e,r){return function(t,e,r){function o(t){return null!=t}function i(t){return"Object"===n(t)}function a(t,e){return"string"==typeof e&&(e=ut(e)),Array.from(t).filter((t=>!e.some((e=>dt.isMatch(t,e,{caseSensitive:!0})))))}const c=Object.prototype.hasOwnProperty,u=["any","anything","every","everything","all","whatever","whatevs"];if(!o(t))throw new Error("check-types-mini: [THROW_ID_01] First argument is missing!");const f={...bt,...r};if("string"==typeof f.ignoreKeys&&(f.ignoreKeys=[f.ignoreKeys]),"string"==typeof f.ignorePaths&&(f.ignorePaths=[f.ignorePaths]),"string"==typeof f.acceptArraysIgnore&&(f.acceptArraysIgnore=[f.acceptArraysIgnore]),f.msg=`${f.msg}`.trim(),":"===f.msg[f.msg.length-1]&&(f.msg=f.msg.slice(0,f.msg.length-1).trim()),i(f.schema))Object.keys(f.schema).forEach((t=>{if(i(f.schema[t])){const e={};j(f.schema[t],((r,n,o)=>{const a=void 0!==n?n:r;return Array.isArray(a)||i(a)||(e[`${t}.${o.path}`]=a),a})),delete f.schema[t],f.schema={...f.schema,...e}}})),Object.keys(f.schema).forEach((t=>{Array.isArray(f.schema[t])||(f.schema[t]=[f.schema[t]]),f.schema[t]=f.schema[t].map((t=>`${t}`.toLowerCase().trim()))}));else if(null!=f.schema)throw new Error(`check-types-mini: opts.schema was customised to ${JSON.stringify(f.schema,null,0)} which is not object but ${typeof f.schema}`);if(o(e)||(e={}),f.enforceStrictKeyset)if(o(f.schema)&&Object.keys(f.schema).length>0){if(e&&a(s(Object.keys(t),Object.keys(e).concat(Object.keys(f.schema))),f.ignoreKeys).length){const r=s(Object.keys(t),Object.keys(e).concat(Object.keys(f.schema)));throw new TypeError(`${f.msg}: ${f.optsVarName}.enforceStrictKeyset is on and the following key${r.length>1?"s":""} ${r.length>1?"are":"is"} not covered by schema and/or reference objects: ${r.join(", ")}`)}}else{if(!(i(e)&&Object.keys(e).length>0))throw new TypeError(`${f.msg}: Both ${f.optsVarName}.schema and reference objects are missing! We don't have anything to match the keys as you requested via opts.enforceStrictKeyset!`);if(0!==a(s(Object.keys(t),Object.keys(e)),f.ignoreKeys).length){const r=s(Object.keys(t),Object.keys(e));throw new TypeError(`${f.msg}: The input object has key${r.length>1?"s":""} which ${r.length>1?"are":"is"} not covered by the reference object: ${r.join(", ")}`)}if(0!==a(s(Object.keys(e),Object.keys(t)),f.ignoreKeys).length){const r=s(Object.keys(e),Object.keys(t));throw new TypeError(`${f.msg}: The reference object has key${r.length>1?"s":""} which ${r.length>1?"are":"is"} not present in the input object: ${r.join(", ")}`)}}const p=[];j(t,((r,o,a)=>{let s=o,l=r;if("array"===a.parentType&&(l=void 0,s=r),Array.isArray(p)&&p.length&&p.some((t=>a.path.startsWith(t))))return s;if(l&&f.ignoreKeys.some((t=>dt.isMatch(l,t))))return s;if(f.ignorePaths.some((t=>dt.isMatch(a.path,t))))return s;const y=!(!i(s)&&!Array.isArray(s)&&Array.isArray(a.parent));let h=!1;i(f.schema)&&c.call(f.schema,a.path)&&(h=!0);let g=!1;if(i(e)&&ft.has(e,a.path)&&(g=!0),f.enforceStrictKeyset&&y&&!h&&!g)throw new TypeError(`${f.msg}: ${f.optsVarName}.${a.path} is neither covered by reference object (second input argument), nor ${f.optsVarName}.schema! To stop this error, turn off ${f.optsVarName}.enforceStrictKeyset or provide some type reference (2nd argument or ${f.optsVarName}.schema).\n\nDebug info:\n\nobj = ${JSON.stringify(t,null,4)}\n\nref = ${JSON.stringify(e,null,4)}\n\ninnerObj = ${JSON.stringify(a,null,4)}\n\nopts = ${JSON.stringify(f,null,4)}\n\ncurrent = ${JSON.stringify(s,null,4)}\n\n`);if(h){const t=ut(f.schema[a.path]).map((t=>`${t}`.toLowerCase()));if(ft.set(f.schema,a.path,t),ct(t,u).length)p.push(a.path);else if(!0!==s&&!1!==s&&!t.includes(n(s).toLowerCase())||(!0===s||!1===s)&&!t.includes(String(s))&&!t.includes("boolean")){if(!Array.isArray(s)||!f.acceptArrays)throw new TypeError(`${f.msg}: ${f.optsVarName}.${a.path} was customised to ${"string"!==n(s)?'"':""}${JSON.stringify(s,null,0)}${"string"!==n(s)?'"':""} (type: ${n(s).toLowerCase()}) which is not among the allowed types in schema (which is equal to ${JSON.stringify(t,null,0)})`);for(let e=0,r=s.length;e<r;e++)if(!t.includes(n(s[e]).toLowerCase()))throw new TypeError(`${f.msg}: ${f.optsVarName}.${a.path}.${e}, the ${e}th element (equal to ${JSON.stringify(s[e],null,0)}) is of a type ${n(s[e]).toLowerCase()}, but only the following are allowed by the ${f.optsVarName}.schema: ${t.join(", ")}`)}}else if(e&&i(e)&&g){const t=ft.get(e,a.path);if(f.acceptArrays&&Array.isArray(s)&&!f.acceptArraysIgnore.includes(r)){if(!s.every((t=>n(t).toLowerCase()===n(e[r]).toLowerCase())))throw new TypeError(`${f.msg}: ${f.optsVarName}.${a.path} was customised to be array, but not all of its elements are ${n(e[r]).toLowerCase()}-type`)}else if(n(s)!==n(t))throw new TypeError(`${f.msg}: ${f.optsVarName}.${a.path} was customised to ${"string"===n(s).toLowerCase()?"":'"'}${JSON.stringify(s,null,0)}${"string"===n(s).toLowerCase()?"":'"'} which is not ${n(t).toLowerCase()} but ${n(s).toLowerCase()}`)}return s}))}(t,e,r)},Object.defineProperty(t,"__esModule",{value:!0})}));
*/function ut(t){return"string"==typeof t?t.length?[t]:[]:t}var st={exports:{}};!function(t){t.exports=function(){var t=Object.prototype.toString;function e(t,e){return null!=t&&Object.prototype.hasOwnProperty.call(t,e)}function r(t){if(!t)return!0;if(i(t)&&0===t.length)return!0;if("string"!=typeof t){for(var r in t)if(e(t,r))return!1;return!0}return!1}function n(e){return t.call(e)}function o(t){return"object"==typeof t&&"[object Object]"===n(t)}var i=Array.isArray||function(e){return"[object Array]"===t.call(e)};function a(t){return"boolean"==typeof t||"[object Boolean]"===n(t)}function c(t){var e=parseInt(t);return e.toString()===t?e:t}function u(t){var n,u=function(t){return Object.keys(u).reduce((function(e,r){return"create"===r||"function"==typeof u[r]&&(e[r]=u[r].bind(u,t)),e}),{})};function s(t,e){if(n(t,e))return t[e]}function f(e,r,n,o){if("number"==typeof r&&(r=[r]),!r||0===r.length)return e;if("string"==typeof r)return f(e,r.split(".").map(c),n,o);var i=r[0];"string"!=typeof i&&"number"!=typeof i&&(i=String(i));var a=s(e,i);if(t.includeInheritedProps&&("__proto__"===i||"constructor"===i&&"function"==typeof a))throw new Error("For security reasons, object's magic properties cannot be set");return 1===r.length?(void 0!==a&&o||(e[i]=n),a):(void 0===a&&(e[i]="number"==typeof r[1]?[]:{}),f(e[i],r.slice(1),n,o))}return n=(t=t||{}).includeInheritedProps?function(){return!0}:function(t,r){return"number"==typeof r&&Array.isArray(t)||e(t,r)},u.has=function(r,n){if("number"==typeof n?n=[n]:"string"==typeof n&&(n=n.split(".")),!n||0===n.length)return!!r;for(var o=0;o<n.length;o++){var a=c(n[o]);if(!("number"==typeof a&&i(r)&&a<r.length||(t.includeInheritedProps?a in Object(r):e(r,a))))return!1;r=r[a]}return!0},u.ensureExists=function(t,e,r){return f(t,e,r,!0)},u.set=function(t,e,r,n){return f(t,e,r,n)},u.insert=function(t,e,r,n){var o=u.get(t,e);n=~~n,i(o)||u.set(t,e,o=[]),o.splice(n,0,r)},u.empty=function(t,e){var c,s;if(!r(e)&&null!=t&&(c=u.get(t,e))){if("string"==typeof c)return u.set(t,e,"");if(a(c))return u.set(t,e,!1);if("number"==typeof c)return u.set(t,e,0);if(i(c))c.length=0;else{if(!o(c))return u.set(t,e,null);for(s in c)n(c,s)&&delete c[s]}}},u.push=function(t,e){var r=u.get(t,e);i(r)||u.set(t,e,r=[]),r.push.apply(r,Array.prototype.slice.call(arguments,2))},u.coalesce=function(t,e,r){for(var n,o=0,i=e.length;o<i;o++)if(void 0!==(n=u.get(t,e[o])))return n;return r},u.get=function(t,e,r){if("number"==typeof e&&(e=[e]),!e||0===e.length)return t;if(null==t)return r;if("string"==typeof e)return u.get(t,e.split("."),r);var n=c(e[0]),o=s(t,n);return void 0===o?r:1===e.length?o:u.get(t[n],e.slice(1),r)},u.del=function(t,e){if("number"==typeof e&&(e=[e]),null==t)return t;if(r(e))return t;if("string"==typeof e)return u.del(t,e.split("."));var o=c(e[0]);return n(t,o)?1!==e.length?u.del(t[o],e.slice(1)):(i(t)?t.splice(o,1):delete t[o],t):t},u}var s=u();return s.create=u,s.withInheritedProps=u({includeInheritedProps:!0}),s}()}(st);var ft=st.exports,pt={exports:{}};const lt=t=>{if("string"!=typeof t)throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")},yt=new Map;function ht(t,e){if(!Array.isArray(t))switch(typeof t){case"string":t=[t];break;case"undefined":t=[];break;default:throw new TypeError(`Expected '${e}' to be a string or an array, but got a type of '${typeof t}'`)}return t.filter((t=>{if("string"!=typeof t){if(void 0===t)return!1;throw new TypeError(`Expected '${e}' to be an array of strings, but found a type of '${typeof t}' in the array`)}return!0}))}function gt(t,e){e={caseSensitive:!1,...e};const r=t+JSON.stringify(e);if(yt.has(r))return yt.get(r);const n="!"===t[0];n&&(t=t.slice(1)),t=lt(t).replace(/\\\*/g,"[\\s\\S]*");const o=new RegExp(`^${t}$`,e.caseSensitive?"":"i");return o.negated=n,yt.set(r,o),o}pt.exports=(t,e,r)=>{if(t=ht(t,"inputs"),0===(e=ht(e,"patterns")).length)return[];const n="!"===e[0][0];e=e.map((t=>gt(t,r)));const o=[];for(const r of t){let t=n;for(const n of e)n.test(r)&&(t=!n.negated);t&&o.push(r)}return o},pt.exports.isMatch=(t,e,r)=>(t=ht(t,"inputs"),0!==(e=ht(e,"patterns")).length&&t.some((t=>e.every((e=>{const n=gt(e,r),o=n.test(t);return n.negated?!o:o})))));var dt=pt.exports;const bt={ignoreKeys:[],ignorePaths:[],acceptArrays:!1,acceptArraysIgnore:[],enforceStrictKeyset:!0,schema:{},msg:"check-types-mini",optsVarName:"opts"};t.checkTypesMini=function(t,e,r){return function(t,e,r){function o(t){return null!=t}function i(t){return"Object"===n(t)}function a(t,e){return"string"==typeof e&&(e=ut(e)),Array.from(t).filter((t=>!e.some((e=>dt.isMatch(t,e,{caseSensitive:!0})))))}const c=Object.prototype.hasOwnProperty,u=["any","anything","every","everything","all","whatever","whatevs"];if(!o(t))throw new Error("check-types-mini: [THROW_ID_01] First argument is missing!");const f={...bt,...r};if("string"==typeof f.ignoreKeys&&(f.ignoreKeys=[f.ignoreKeys]),"string"==typeof f.ignorePaths&&(f.ignorePaths=[f.ignorePaths]),"string"==typeof f.acceptArraysIgnore&&(f.acceptArraysIgnore=[f.acceptArraysIgnore]),f.msg=`${f.msg}`.trim(),":"===f.msg[f.msg.length-1]&&(f.msg=f.msg.slice(0,f.msg.length-1).trim()),i(f.schema))Object.keys(f.schema).forEach((t=>{if(i(f.schema[t])){const e={};j(f.schema[t],((r,n,o)=>{const a=void 0!==n?n:r;return Array.isArray(a)||i(a)||(e[`${t}.${o.path}`]=a),a})),delete f.schema[t],f.schema={...f.schema,...e}}})),Object.keys(f.schema).forEach((t=>{Array.isArray(f.schema[t])||(f.schema[t]=[f.schema[t]]),f.schema[t]=f.schema[t].map((t=>`${t}`.toLowerCase().trim()))}));else if(null!=f.schema)throw new Error(`check-types-mini: opts.schema was customised to ${JSON.stringify(f.schema,null,0)} which is not object but ${typeof f.schema}`);if(o(e)||(e={}),f.enforceStrictKeyset)if(o(f.schema)&&Object.keys(f.schema).length>0){if(e&&a(s(Object.keys(t),Object.keys(e).concat(Object.keys(f.schema))),f.ignoreKeys).length){const r=s(Object.keys(t),Object.keys(e).concat(Object.keys(f.schema)));throw new TypeError(`${f.msg}: ${f.optsVarName}.enforceStrictKeyset is on and the following key${r.length>1?"s":""} ${r.length>1?"are":"is"} not covered by schema and/or reference objects: ${r.join(", ")}`)}}else{if(!(i(e)&&Object.keys(e).length>0))throw new TypeError(`${f.msg}: Both ${f.optsVarName}.schema and reference objects are missing! We don't have anything to match the keys as you requested via opts.enforceStrictKeyset!`);if(0!==a(s(Object.keys(t),Object.keys(e)),f.ignoreKeys).length){const r=s(Object.keys(t),Object.keys(e));throw new TypeError(`${f.msg}: The input object has key${r.length>1?"s":""} which ${r.length>1?"are":"is"} not covered by the reference object: ${r.join(", ")}`)}if(0!==a(s(Object.keys(e),Object.keys(t)),f.ignoreKeys).length){const r=s(Object.keys(e),Object.keys(t));throw new TypeError(`${f.msg}: The reference object has key${r.length>1?"s":""} which ${r.length>1?"are":"is"} not present in the input object: ${r.join(", ")}`)}}const p=[];j(t,((r,o,a)=>{let s=o,l=r;if("array"===a.parentType&&(l=void 0,s=r),Array.isArray(p)&&p.length&&p.some((t=>a.path.startsWith(t))))return s;if(l&&f.ignoreKeys.some((t=>dt.isMatch(l,t))))return s;if(f.ignorePaths.some((t=>dt.isMatch(a.path,t))))return s;const y=!(!i(s)&&!Array.isArray(s)&&Array.isArray(a.parent));let h=!1;i(f.schema)&&c.call(f.schema,a.path)&&(h=!0);let g=!1;if(i(e)&&ft.has(e,a.path)&&(g=!0),f.enforceStrictKeyset&&y&&!h&&!g)throw new TypeError(`${f.msg}: ${f.optsVarName}.${a.path} is neither covered by reference object (second input argument), nor ${f.optsVarName}.schema! To stop this error, turn off ${f.optsVarName}.enforceStrictKeyset or provide some type reference (2nd argument or ${f.optsVarName}.schema).\n\nDebug info:\n\nobj = ${JSON.stringify(t,null,4)}\n\nref = ${JSON.stringify(e,null,4)}\n\ninnerObj = ${JSON.stringify(a,null,4)}\n\nopts = ${JSON.stringify(f,null,4)}\n\ncurrent = ${JSON.stringify(s,null,4)}\n\n`);if(h){const t=ut(f.schema[a.path]).map((t=>`${t}`.toLowerCase()));if(ft.set(f.schema,a.path,t),ct(t,u).length)p.push(a.path);else if(!0!==s&&!1!==s&&!t.includes(n(s).toLowerCase())||(!0===s||!1===s)&&!t.includes(String(s))&&!t.includes("boolean")){if(!Array.isArray(s)||!f.acceptArrays)throw new TypeError(`${f.msg}: ${f.optsVarName}.${a.path} was customised to ${"string"!==n(s)?'"':""}${JSON.stringify(s,null,0)}${"string"!==n(s)?'"':""} (type: ${n(s).toLowerCase()}) which is not among the allowed types in schema (which is equal to ${JSON.stringify(t,null,0)})`);for(let e=0,r=s.length;e<r;e++)if(!t.includes(n(s[e]).toLowerCase()))throw new TypeError(`${f.msg}: ${f.optsVarName}.${a.path}.${e}, the ${e}th element (equal to ${JSON.stringify(s[e],null,0)}) is of a type ${n(s[e]).toLowerCase()}, but only the following are allowed by the ${f.optsVarName}.schema: ${t.join(", ")}`)}}else if(e&&i(e)&&g){const t=ft.get(e,a.path);if(f.acceptArrays&&Array.isArray(s)&&!f.acceptArraysIgnore.includes(r)){if(!s.every((t=>n(t).toLowerCase()===n(e[r]).toLowerCase())))throw new TypeError(`${f.msg}: ${f.optsVarName}.${a.path} was customised to be array, but not all of its elements are ${n(e[r]).toLowerCase()}-type`)}else if(n(s)!==n(t))throw new TypeError(`${f.msg}: ${f.optsVarName}.${a.path} was customised to ${"string"===n(s).toLowerCase()?"":'"'}${JSON.stringify(s,null,0)}${"string"===n(s).toLowerCase()?"":'"'} which is not ${n(t).toLowerCase()} but ${n(s).toLowerCase()}`)}return s}))}(t,e,r)},Object.defineProperty(t,"__esModule",{value:!0})}));
{
"name": "check-types-mini",
"version": "6.1.0",
"version": "7.0.0",
"description": "Validate options object",

@@ -31,5 +31,7 @@ "keywords": [

},
"main": "dist/check-types-mini.cjs.js",
"module": "dist/check-types-mini.esm.js",
"browser": "dist/check-types-mini.umd.js",
"type": "module",
"exports": {
"script": "./dist/check-types-mini.umd.js",
"default": "./dist/check-types-mini.esm.js"
},
"types": "types/index.d.ts",

@@ -54,3 +56,3 @@ "scripts": {

"test:examples": "../../scripts/test-examples.js && npm run lect && npm run prettier",
"unittest": "./node_modules/.bin/tap --no-only --output-file=testStats.md --reporter=terse && tsc -p tsconfig.json --noEmit && npm run clean_cov && npm run perf",
"unittest": "tap --no-only --output-file=testStats.md --reporter=terse && tsc -p tsconfig.json --noEmit && npm run clean_cov && npm run perf",
"clean_cov": "../../scripts/leaveCoverageTotalOnly.js",

@@ -60,2 +62,3 @@ "clean_types": "../../scripts/cleanTypes.js"

"tap": {
"check-coverage": false,
"coverage-report": [

@@ -65,5 +68,6 @@ "json-summary",

],
"nyc-arg": [
"--exclude=**/*.cjs.js",
"--exclude=**/*.umd.js"
"node-arg": [
"--no-warnings",
"--experimental-loader",
"@istanbuljs/esm-loader-hook"
],

@@ -87,49 +91,53 @@ "timeout": 0

"dependencies": {
"@babel/runtime": "^7.14.0",
"arrayiffy-if-string": "^3.14.0",
"ast-monkey-traverse": "^2.1.0",
"@babel/runtime": "^7.15.4",
"arrayiffy-if-string": "^4.0.0",
"ast-monkey-traverse": "^3.0.0",
"lodash.intersection": "^4.4.0",
"lodash.pullall": "^4.2.0",
"matcher": "^4.0.0",
"object-path": "^0.11.5",
"object-path": "^0.11.7",
"type-detect": "^4.0.8"
},
"devDependencies": {
"@babel/cli": "^7.14.3",
"@babel/core": "^7.14.3",
"@babel/node": "^7.14.2",
"@babel/plugin-external-helpers": "^7.12.13",
"@babel/plugin-proposal-class-properties": "^7.13.0",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.14.2",
"@babel/plugin-proposal-object-rest-spread": "^7.14.2",
"@babel/plugin-proposal-optional-chaining": "^7.14.2",
"@babel/plugin-transform-runtime": "^7.14.3",
"@babel/preset-env": "^7.14.2",
"@babel/preset-typescript": "^7.13.0",
"@babel/register": "^7.13.16",
"@babel/cli": "^7.15.4",
"@babel/core": "^7.15.5",
"@babel/node": "^7.15.4",
"@babel/plugin-external-helpers": "^7.14.5",
"@babel/plugin-proposal-class-properties": "^7.14.5",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.14.5",
"@babel/plugin-proposal-object-rest-spread": "^7.15.6",
"@babel/plugin-proposal-optional-chaining": "^7.14.5",
"@babel/plugin-transform-runtime": "^7.15.0",
"@babel/preset-env": "^7.15.6",
"@babel/preset-typescript": "^7.15.0",
"@babel/register": "^7.15.3",
"@istanbuljs/esm-loader-hook": "^0.1.2",
"@rollup/plugin-babel": "^5.3.0",
"@rollup/plugin-commonjs": "^19.0.0",
"@rollup/plugin-node-resolve": "^13.0.0",
"@rollup/plugin-strip": "^2.0.1",
"@rollup/plugin-typescript": "^8.2.1",
"@rollup/plugin-commonjs": "^20.0.0",
"@rollup/plugin-node-resolve": "^13.0.4",
"@rollup/plugin-strip": "^2.1.0",
"@rollup/plugin-typescript": "^8.2.5",
"@types/lodash.intersection": "^4.4.6",
"@types/lodash.pullall": "^4.2.6",
"@types/node": "^15.6.0",
"@types/tap": "^15.0.1",
"@typescript-eslint/eslint-plugin": "^4.24.0",
"@typescript-eslint/parser": "^4.24.0",
"core-js": "^3.12.1",
"@types/node": "^16.9.1",
"@types/tap": "^15.0.5",
"@typescript-eslint/eslint-plugin": "^4.31.0",
"@typescript-eslint/parser": "^4.31.0",
"core-js": "^3.17.3",
"cross-env": "^7.0.3",
"eslint": "^7.27.0",
"lect": "^0.17.0",
"rollup": "^2.49.0",
"eslint": "^7.32.0",
"lect": "^0.18.0",
"rollup": "^2.56.3",
"rollup-plugin-ascii": "^0.0.3",
"rollup-plugin-banner": "^0.2.1",
"rollup-plugin-cleanup": "^3.2.1",
"rollup-plugin-dts": "^3.0.1",
"rollup-plugin-dts": "^4.0.0",
"rollup-plugin-terser": "^7.0.2",
"tap": "^14.11.0",
"tslib": "^2.2.0",
"typescript": "^4.2.4"
"tap": "^15.0.9",
"tslib": "^2.3.1",
"typescript": "^4.4.2"
},
"engines": {
"node": ">=12"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc