From 98168b8154ea783ac745603bf940b87ebdcc10de Mon Sep 17 00:00:00 2001 From: Lajos Meszaros Date: Fri, 21 Jan 2022 18:53:12 +0100 Subject: [PATCH] Moved isNumber into functions.js --- index.js | 2 +- src/functions.js | 15 +++++++++++++++ src/index.js | 13 +------------ 3 files changed, 17 insertions(+), 13 deletions(-) create mode 100644 src/functions.js diff --git a/index.js b/index.js index e4319e9..e702644 100644 --- a/index.js +++ b/index.js @@ -1 +1 @@ -var I=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports);var B=I((D,S)=>{S.exports=A;A.flatten=A;A.unflatten=K;function N(e){return e&&e.constructor&&typeof e.constructor.isBuffer=="function"&&e.constructor.isBuffer(e)}function F(e){return e}function A(e,r){r=r||{};let t=r.delimiter||".",d=r.maxDepth,v=r.transformKey||F,l={};function p(_,u,O){O=O||1,Object.keys(_).forEach(function(c){let i=_[c],n=r.safe&&Array.isArray(i),a=Object.prototype.toString.call(i),o=N(i),m=a==="[object Object]"||a==="[object Array]",b=u?u+t+v(c):v(c);if(!n&&!o&&m&&Object.keys(i).length&&(!r.maxDepth||O0&&(n=_(i.shift()),a=_(i[0]))}o[n]=K(e[c],r)}),l}});var q=B().unflatten,z=B();function $(e){if(typeof e=="number")return!0;if(/^0x[0-9a-f]+$/i.test(e))try{return Number(e)<=Number.MAX_SAFE_INTEGER}catch{return!1}return/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(e)}module.exports=function(e,r){r||(r={});var t={bools:{},strings:{},array:{},aliases:{},unknownFn:null};typeof r.unknown=="function"&&(t.unknownFn=r.unknown),typeof r.boolean=="boolean"&&r.boolean?t.allBools=!0:[].concat(r.boolean).filter(Boolean).forEach(function(f){t.bools[f]=!0});var d=t.aliases;Object.keys(r.alias||{}).forEach(function(f){d[f]=[].concat(r.alias[f]),d[f].forEach(function(s){d[s]=[f].concat(d[f].filter(function(E){return s!==E}))})}),[].concat(r.string).filter(Boolean).forEach(function(f){t.strings[f]=!0,t.aliases[f]&&(t.strings[t.aliases[f]]=!0)}),[].concat(r.array).filter(Boolean).forEach(function(f){t.array[f]=!0,t.aliases[f]&&(t.array[t.aliases[f]]=!0)});var v=z(r.default||{}),l={_:[]};Object.keys(t.bools).forEach(function(f){u(f,v[f]===void 0?!1:v[f])});var p=[];!r.stopEarly&&e.indexOf("--")!==-1&&(p=e.slice(e.indexOf("--")+1),e=e.slice(0,e.indexOf("--")));function _(f,s){return t.allBools&&/^--[^=]+$/.test(s)||t.strings[f]||t.bools[f]||t.array[f]||t.aliases[f]}function u(f,s,E){if(!(E&&t.unknownFn&&!_(f,E)&&t.unknownFn(E)===!1)){var j=!t.strings[f]&&$(s)?Number(s):s;O(l,f,j),(d[f]||[]).forEach(function(x){O(l,x,j)})}}function O(f,s,E){var j=f;s!=="__proto__"&&(j[s]===void 0?j[s]=t.array[s]?[E]:E:t.bools[s]||typeof j[s]=="boolean"?j[s]=E:Array.isArray(j[s])?j[s].push(E):j[s]=[j[s],E])}function c(f){return d[f].some(function(s){return t.bools[s]})}for(var i=0;i()=>(f||n((f={exports:{}}).exports,f),f.exports);var B=N((R,$)=>{$.exports=A;A.flatten=A;A.unflatten=S;function F(n){return n&&n.constructor&&typeof n.constructor.isBuffer=="function"&&n.constructor.isBuffer(n)}function K(n){return n}function A(n,f){f=f||{};let t=f.delimiter||".",d=f.maxDepth,v=f.transformKey||K,l={};function _(p,u,O){O=O||1,Object.keys(p).forEach(function(c){let i=p[c],e=f.safe&&Array.isArray(i),a=Object.prototype.toString.call(i),o=F(i),m=a==="[object Object]"||a==="[object Array]",b=u?u+t+v(c):v(c);if(!e&&!o&&m&&Object.keys(i).length&&(!f.maxDepth||O0&&(e=p(i.shift()),a=p(i[0]))}o[e]=S(n[c],f)}),l}});var q=N((T,x)=>{function Z(n){if(typeof n=="number")return!0;if(/^0x[0-9a-f]+$/i.test(n))try{return Number(n)<=Number.MAX_SAFE_INTEGER}catch{return!1}return/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(n)}x.exports={isNumber:Z}});var D=B().unflatten,G=B(),{isNumber:I}=q();module.exports=function(n,f){f||(f={});var t={bools:{},strings:{},array:{},aliases:{},unknownFn:null};typeof f.unknown=="function"&&(t.unknownFn=f.unknown),typeof f.boolean=="boolean"&&f.boolean?t.allBools=!0:[].concat(f.boolean).filter(Boolean).forEach(function(r){t.bools[r]=!0});var d=t.aliases;Object.keys(f.alias||{}).forEach(function(r){d[r]=[].concat(f.alias[r]),d[r].forEach(function(s){d[s]=[r].concat(d[r].filter(function(E){return s!==E}))})}),[].concat(f.string).filter(Boolean).forEach(function(r){t.strings[r]=!0,t.aliases[r]&&(t.strings[t.aliases[r]]=!0)}),[].concat(f.array).filter(Boolean).forEach(function(r){t.array[r]=!0,t.aliases[r]&&(t.array[t.aliases[r]]=!0)});var v=G(f.default||{}),l={_:[]};Object.keys(t.bools).forEach(function(r){u(r,v[r]===void 0?!1:v[r])});var _=[];!f.stopEarly&&n.indexOf("--")!==-1&&(_=n.slice(n.indexOf("--")+1),n=n.slice(0,n.indexOf("--")));function p(r,s){return t.allBools&&/^--[^=]+$/.test(s)||t.strings[r]||t.bools[r]||t.array[r]||t.aliases[r]}function u(r,s,E){if(!(E&&t.unknownFn&&!p(r,E)&&t.unknownFn(E)===!1)){var j=!t.strings[r]&&I(s)?Number(s):s;O(l,r,j),(d[r]||[]).forEach(function(z){O(l,z,j)})}}function O(r,s,E){var j=r;s!=="__proto__"&&(j[s]===void 0?j[s]=t.array[s]?[E]:E:t.bools[s]||typeof j[s]=="boolean"?j[s]=E:Array.isArray(j[s])?j[s].push(E):j[s]=[j[s],E])}function c(r){return d[r].some(function(s){return t.bools[s]})}for(var i=0;i