@poppinss/utils 6.5.0-8 → 6.5.1
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/README.md +2 -2
- package/build/{chunk-XHQBV7AF.js → chunk-IOBSMUFC.js} +1 -0
- package/build/chunk-IOBSMUFC.js.map +1 -0
- package/build/{chunk-OKRMWJO4.js → chunk-K76IL3UP.js} +2 -1
- package/build/chunk-K76IL3UP.js.map +1 -0
- package/build/{chunk-PWRXO3NF.js → chunk-NKGAOHNN.js} +1 -0
- package/build/chunk-NKGAOHNN.js.map +1 -0
- package/build/index.d.ts +19 -278
- package/build/index.js +3 -2
- package/build/index.js.map +1 -0
- package/build/lodash/main.cjs +32 -34
- package/build/src/assert.d.ts +3 -5
- package/build/src/assert.js +1 -0
- package/build/src/assert.js.map +1 -0
- package/build/src/base64.d.ts +33 -0
- package/build/src/compose.d.ts +19 -0
- package/build/src/define_static_property.d.ts +10 -0
- package/build/src/exception.d.ts +52 -0
- package/build/src/exceptions/invalid_arguments_exception.d.ts +5 -0
- package/build/src/exceptions/runtime_exception.d.ts +5 -0
- package/build/src/flatten.d.ts +4 -0
- package/build/src/fs_import_all.d.ts +20 -0
- package/build/src/fs_read_all.d.ts +20 -0
- package/build/src/import_default.d.ts +6 -0
- package/build/src/is_script_file.d.ts +5 -0
- package/build/src/json/main.d.ts +3 -15
- package/build/src/json/main.js +2 -1
- package/build/src/json/main.js.map +1 -0
- package/build/src/json/safe_parse.d.ts +5 -0
- package/build/src/json/safe_stringify.d.ts +6 -0
- package/build/src/message_builder.d.ts +17 -0
- package/build/src/natural_sort.d.ts +4 -0
- package/build/src/object_builder.d.ts +58 -0
- package/build/src/safe_equal.d.ts +11 -0
- package/build/src/slash.d.ts +1 -0
- package/build/src/string/bytes.d.ts +11 -0
- package/build/src/string/change_case.d.ts +42 -0
- package/build/src/string/excerpt.d.ts +11 -0
- package/build/src/string/interpolate.d.ts +8 -0
- package/build/src/string/main.d.ts +15 -118
- package/build/src/string/main.js +3 -2
- package/build/src/string/main.js.map +1 -0
- package/build/src/string/milliseconds.d.ts +9 -0
- package/build/src/string/ordinal.d.ts +4 -0
- package/build/src/string/pluralize.d.ts +16 -0
- package/build/src/string/random.d.ts +4 -0
- package/build/src/string/seconds.d.ts +9 -0
- package/build/src/string/sentence.d.ts +8 -0
- package/build/src/string/slugify.d.ts +6 -0
- package/build/src/string/truncate.d.ts +10 -0
- package/build/src/string_builder.d.ts +1 -3
- package/build/src/string_builder.js +3 -2
- package/build/src/string_builder.js.map +1 -0
- package/build/src/types.d.ts +11 -9
- package/build/src/types.js +1 -0
- package/build/src/types.js.map +1 -0
- package/package.json +21 -16
package/build/lodash/main.cjs
CHANGED
|
@@ -3,37 +3,35 @@
|
|
|
3
3
|
* Lodash (Custom Build) lodash.com/license | Underscore.js 1.8.3 underscorejs.org/LICENSE
|
|
4
4
|
* Build: `lodash include="pick,omit,has,get,set,unset,mergeWith,merge,size,clone,cloneDeep,toPath" --production`
|
|
5
5
|
*/
|
|
6
|
-
;(function(){function t(t,
|
|
7
|
-
return t}function o(t){return function(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
return
|
|
12
|
-
}function
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
var
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
return
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
},i.hasIn=Ot,i.identity=kt,i.isArguments=Xe,i.isArray=Ye,i.isArrayLike=pt,i.isArrayLikeObject=ht,i.isBuffer=Ze,i.isFunction=yt,i.isLength=jt,i.isMap=tn,i.isObject=_t,i.isObjectLike=dt,i.isPlainObject=gt,i.isSet=en,i.isString=vt,i.isSymbol=At,i.isTypedArray=nn,i.last=lt,i.stubArray=Ft,i.stubFalse=It,i.size=function(t){if(null==t)return 0;if(pt(t)){if(vt(t))if(Wt.test(t)){for(var e=Vt.lastIndex=0;Vt.test(t);)++e;t=e}else t=re(t);else t=t.length;return t}return e=Je(t),"[object Map]"==e||"[object Set]"==e?t.size:I(t).length;
|
|
39
|
-
},i.toString=wt,i.VERSION="4.17.5",typeof define=="function"&&typeof define.amd=="object"&&define.amd?(Kt._=i, define(function(){return i})):Xt?((Xt.exports=i)._=i,Qt._=i):Kt._=i}).call(this);
|
|
6
|
+
;(function(){function t(t,n,r){switch(r.length){case 0:return t.call(n);case 1:return t.call(n,r[0]);case 2:return t.call(n,r[0],r[1]);case 3:return t.call(n,r[0],r[1],r[2])}return t.apply(n,r)}function n(t,n){for(var r=-1,e=null==t?0:t.length;++r<e&&n(t[r],r,t)!==false;);return t}function r(t,n){for(var r=-1,e=null==t?0:t.length,u=0,o=[];++r<e;){var i=t[r];n(i,r,t)&&(o[u++]=i)}return o}function e(t,n){for(var r=-1,e=null==t?0:t.length,u=Array(e);++r<e;)u[r]=n(t[r],r,t);return u}function u(t,n){for(var r=-1,e=n.length,u=t.length;++r<e;)t[u+r]=n[r];
|
|
7
|
+
return t}function o(t){return function(n){return null==n?In:n[t]}}function i(t,n){for(var r=-1,e=Array(t);++r<t;)e[r]=n(r);return e}function c(t){return function(n){return t(n)}}function f(t,n){return null==t?In:t[n]}function a(t){return Kr.test(t)}function l(t,n){return function(r){return t(n(r))}}function s(t,n){return"__proto__"==n?In:t[n]}function h(t){return a(t)?p(t):ae(t)}function p(t){for(var n=Jr.lastIndex=0;Jr.test(t);)++n;return n}function y(){}function v(t){var n=-1,r=null==t?0:t.length;
|
|
8
|
+
for(this.clear();++n<r;){var e=t[n];this.set(e[0],e[1])}}function b(){this.__data__=De?De(null):{},this.size=0}function _(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}function g(t){var n=this.__data__;if(De){var r=n[t];return r===Mn?In:r}return ve.call(n,t)?n[t]:In}function d(t){var n=this.__data__;return De?n[t]!==In:ve.call(n,t)}function j(t,n){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=De&&n===In?Mn:n,this}function w(t){var n=-1,r=null==t?0:t.length;for(this.clear();++n<r;){
|
|
9
|
+
var e=t[n];this.set(e[0],e[1])}}function O(){this.__data__=[],this.size=0}function m(t){var n=this.__data__,r=N(n,t);return!(r<0)&&(r==n.length-1?n.pop():Se.call(n,r,1),--this.size,true)}function A(t){var n=this.__data__,r=N(n,t);return r<0?In:n[r][1]}function z(t){return N(this.__data__,t)>-1}function x(t,n){var r=this.__data__,e=N(r,t);return e<0?(++this.size,r.push([t,n])):r[e][1]=n,this}function S(t){var n=-1,r=null==t?0:t.length;for(this.clear();++n<r;){var e=t[n];this.set(e[0],e[1])}}function k(){
|
|
10
|
+
this.size=0,this.__data__={hash:new v,map:new(Ue||w),string:new v}}function E(t){var n=$t(this,t).delete(t);return this.size-=n?1:0,n}function P(t){return $t(this,t).get(t)}function I(t){return $t(this,t).has(t)}function $(t,n){var r=$t(this,t),e=r.size;return r.set(t,n),this.size+=r.size==e?0:1,this}function F(t){this.size=(this.__data__=new w(t)).size}function L(){this.__data__=new w,this.size=0}function M(t){var n=this.__data__,r=n.delete(t);return this.size=n.size,r}function T(t){return this.__data__.get(t);
|
|
11
|
+
}function U(t){return this.__data__.has(t)}function B(t,n){var r=this.__data__;if(r instanceof w){var e=r.__data__;if(!Ue||e.length<Fn-1)return e.push([t,n]),this.size=++r.size,this;r=this.__data__=new S(e)}return r.set(t,n),this.size=r.size,this}function C(t,n){var r=ou(t),e=!r&&uu(t),u=!r&&!e&&iu(t),o=!r&&!e&&!u&&au(t),c=r||e||u||o,f=c?i(t.length,String):[],a=f.length;for(var l in t)!n&&!ve.call(t,l)||c&&("length"==l||u&&("offset"==l||"parent"==l)||o&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||Rt(l,a))||f.push(l);
|
|
12
|
+
return f}function R(t,n,r){(r===In||cn(t[n],r))&&(r!==In||n in t)||q(t,n,r)}function D(t,n,r){var e=t[n];ve.call(t,n)&&cn(e,r)&&(r!==In||n in t)||q(t,n,r)}function N(t,n){for(var r=t.length;r--;)if(cn(t[r][0],n))return r;return-1}function V(t,n){return t&&mt(n,On(n),t)}function W(t,n){return t&&mt(n,mn(n),t)}function q(t,n,r){"__proto__"==n&&Pe?Pe(t,n,{configurable:true,enumerable:true,value:r,writable:true}):t[n]=r}function G(t,r,e,u,o,i){var c,f=r&Un,a=r&Bn,l=r&Cn;if(e&&(c=o?e(t,u,o,i):e(t)),c!==In)return c;
|
|
13
|
+
if(!hn(t))return t;var s=ou(t);if(s){if(c=Tt(t),!f)return Ot(t,c)}else{var h=nu(t),p=h==Qn||h==Xn;if(iu(t))return bt(t,f);if(h==nr||h==Wn||p&&!o){if(c=a||p?{}:Ut(t),!f)return a?zt(t,W(c,t)):At(t,V(c,t))}else{if(!Xr[h])return o?t:{};c=Bt(t,h,f)}}i||(i=new F);var y=i.get(t);if(y)return y;if(i.set(t,c),fu(t))return t.forEach(function(n){c.add(G(n,r,e,n,t,i))}),c;if(cu(t))return t.forEach(function(n,u){c.set(u,G(n,r,e,u,t,i))}),c;var v=l?a?It:Pt:a?mn:On,b=s?In:v(t);return n(b||t,function(n,u){b&&(u=n,
|
|
14
|
+
n=t[u]),D(c,u,G(n,r,e,u,t,i))}),c}function H(t,n,r,e,o){var i=-1,c=t.length;for(r||(r=Ct),o||(o=[]);++i<c;){var f=t[i];n>0&&r(f)?n>1?H(f,n-1,r,e,o):u(o,f):e||(o[o.length]=f)}return o}function J(t,n){n=vt(n,t);for(var r=0,e=n.length;null!=t&&r<e;)t=t[Yt(n[r++])];return r&&r==e?t:In}function K(t,n,r){var e=n(t);return ou(t)?e:u(e,r(t))}function Q(t){return null==t?t===In?fr:tr:Ee&&Ee in Object(t)?Lt(t):Jt(t)}function X(t,n){return null!=t&&ve.call(t,n)}function Y(t,n){return null!=t&&n in Object(t);
|
|
15
|
+
}function Z(t){return pn(t)&&Q(t)==Wn}function tt(t){return pn(t)&&nu(t)==Yn}function nt(t){return!(!hn(t)||Wt(t))&&(ln(t)?de:Sr).test(Zt(t))}function rt(t){return pn(t)&&nu(t)==or}function et(t){return pn(t)&&sn(t.length)&&!!Qr[Q(t)]}function ut(t){if(!qt(t))return Fe(t);var n=[];for(var r in Object(t))ve.call(t,r)&&"constructor"!=r&&n.push(r);return n}function ot(t){if(!hn(t))return Ht(t);var n=qt(t),r=[];for(var e in t)("constructor"!=e||!n&&ve.call(t,e))&&r.push(e);return r}function it(t,n,r,e,u){
|
|
16
|
+
t!==n&&Xe(n,function(o,i){if(hn(o))u||(u=new F),ct(t,n,i,r,it,e,u);else{var c=e?e(s(t,i),o,i+"",t,n,u):In;c===In&&(c=o),R(t,i,c)}},mn)}function ct(t,n,r,e,u,o,i){var c=s(t,r),f=s(n,r),a=i.get(f);if(a)return R(t,r,a),In;var l=o?o(c,f,r+"",t,n,i):In,h=l===In;if(h){var p=ou(f),y=!p&&iu(f),v=!p&&!y&&au(f);l=f,p||y||v?ou(c)?l=c:an(c)?l=Ot(c):y?(h=false,l=bt(f,true)):v?(h=false,l=wt(f,true)):l=[]:yn(f)||uu(f)?(l=c,uu(c)?l=_n(c):(!hn(c)||e&&ln(c))&&(l=Ut(f))):h=false}h&&(i.set(f,l),u(l,f,e,o,i),i.delete(f)),R(t,r,l);
|
|
17
|
+
}function ft(t,n){return at(t,n,function(n,r){return wn(t,r)})}function at(t,n,r){for(var e=-1,u=n.length,o={};++e<u;){var i=n[e],c=J(t,i);r(c,i)&&st(o,vt(i,t),c)}return o}function lt(t,n){return ru(Kt(t,n,Sn),t+"")}function st(t,n,r,e){if(!hn(t))return t;n=vt(n,t);for(var u=-1,o=n.length,i=o-1,c=t;null!=c&&++u<o;){var f=Yt(n[u]),a=r;if(u!=i){var l=c[f];a=e?e(l,f,c):In,a===In&&(a=hn(l)?l:Rt(n[u+1])?[]:{})}D(c,f,a),c=c[f]}return t}function ht(t,n,r){var e=-1,u=t.length;n<0&&(n=-n>u?0:u+n),r=r>u?u:r,
|
|
18
|
+
r<0&&(r+=u),u=n>r?0:r-n>>>0,n>>>=0;for(var o=Array(u);++e<u;)o[e]=t[e+n];return o}function pt(t){if(typeof t=="string")return t;if(ou(t))return e(t,pt)+"";if(bn(t))return Ke?Ke.call(t):"";var n=t+"";return"0"==n&&1/t==-Nn?"-0":n}function yt(t,n){return n=vt(n,t),t=Qt(t,n),null==t||delete t[Yt(nn(n))]}function vt(t,n){return ou(t)?t:Nt(t,n)?[t]:eu(gn(t))}function bt(t,n){if(n)return t.slice();var r=t.length,e=me?me(r):new t.constructor(r);return t.copy(e),e}function _t(t){var n=new t.constructor(t.byteLength);
|
|
19
|
+
return new Oe(n).set(new Oe(t)),n}function gt(t,n){return new t.constructor(n?_t(t.buffer):t.buffer,t.byteOffset,t.byteLength)}function dt(t){var n=new t.constructor(t.source,xr.exec(t));return n.lastIndex=t.lastIndex,n}function jt(t){return Je?Object(Je.call(t)):{}}function wt(t,n){return new t.constructor(n?_t(t.buffer):t.buffer,t.byteOffset,t.length)}function Ot(t,n){var r=-1,e=t.length;for(n||(n=Array(e));++r<e;)n[r]=t[r];return n}function mt(t,n,r,e){var u=!r;r||(r={});for(var o=-1,i=n.length;++o<i;){
|
|
20
|
+
var c=n[o],f=e?e(r[c],t[c],c,r,t):In;f===In&&(f=t[c]),u?q(r,c,f):D(r,c,f)}return r}function At(t,n){return mt(t,Ze(t),n)}function zt(t,n){return mt(t,tu(t),n)}function xt(t){return lt(function(n,r){var e=-1,u=r.length,o=u>1?r[u-1]:In,i=u>2?r[2]:In;for(o=t.length>3&&typeof o=="function"?(u--,o):In,i&&Dt(r[0],r[1],i)&&(o=u<3?In:o,u=1),n=Object(n);++e<u;){var c=r[e];c&&t(n,c,e,o)}return n})}function St(t){return function(n,r,e){for(var u=-1,o=Object(n),i=e(n),c=i.length;c--;){var f=i[t?c:++u];if(r(o[f],f,o)===false)break;
|
|
21
|
+
}return n}}function kt(t){return yn(t)?In:t}function Et(t){return ru(Kt(t,In,tn),t+"")}function Pt(t){return K(t,On,Ze)}function It(t){return K(t,mn,tu)}function $t(t,n){var r=t.__data__;return Vt(n)?r[typeof n=="string"?"string":"hash"]:r.map}function Ft(t,n){var r=f(t,n);return nt(r)?r:In}function Lt(t){var n=ve.call(t,Ee),r=t[Ee];try{t[Ee]=In;var e=true}catch(t){}var u=_e.call(t);return e&&(n?t[Ee]=r:delete t[Ee]),u}function Mt(t,n,r){n=vt(n,t);for(var e=-1,u=n.length,o=false;++e<u;){var i=Yt(n[e]);
|
|
22
|
+
if(!(o=null!=t&&r(t,i)))break;t=t[i]}return o||++e!=u?o:(u=null==t?0:t.length,!!u&&sn(u)&&Rt(i,u)&&(ou(t)||uu(t)))}function Tt(t){var n=t.length,r=new t.constructor(n);return n&&"string"==typeof t[0]&&ve.call(t,"index")&&(r.index=t.index,r.input=t.input),r}function Ut(t){return typeof t.constructor!="function"||qt(t)?{}:Qe(Ae(t))}function Bt(t,n,r){var e=t.constructor;switch(n){case lr:return _t(t);case Hn:case Jn:return new e(+t);case sr:return gt(t,r);case hr:case pr:case yr:case vr:case br:case _r:
|
|
23
|
+
case gr:case dr:case jr:return wt(t,r);case Yn:return new e;case Zn:case ir:return new e(t);case ur:return dt(t);case or:return new e;case cr:return jt(t)}}function Ct(t){return ou(t)||uu(t)||!!(ke&&t&&t[ke])}function Rt(t,n){var r=typeof t;return n=null==n?Vn:n,!!n&&("number"==r||"symbol"!=r&&kr.test(t))&&t>-1&&t%1==0&&t<n}function Dt(t,n,r){if(!hn(r))return false;var e=typeof n;return!!("number"==e?fn(r)&&Rt(n,r.length):"string"==e&&n in r)&&cn(r[n],t)}function Nt(t,n){if(ou(t))return false;var r=typeof t;
|
|
24
|
+
return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=t&&!bn(t))||(Or.test(t)||!wr.test(t)||null!=n&&t in Object(n))}function Vt(t){var n=typeof t;return"string"==n||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==t:null===t}function Wt(t){return!!be&&be in t}function qt(t){var n=t&&t.constructor;return t===(typeof n=="function"&&n.prototype||he)}function Gt(t){var n=en(t,function(t){return r.size===Tn&&r.clear(),t}),r=n.cache;return n}function Ht(t){var n=[];if(null!=t)for(var r in Object(t))n.push(r);
|
|
25
|
+
return n}function Jt(t){return _e.call(t)}function Kt(n,r,e){return r=Le(r===In?n.length-1:r,0),function(){for(var u=arguments,o=-1,i=Le(u.length-r,0),c=Array(i);++o<i;)c[o]=u[r+o];o=-1;for(var f=Array(r+1);++o<r;)f[o]=u[o];return f[r]=e(c),t(n,this,f)}}function Qt(t,n){return n.length<2?t:J(t,ht(n,0,-1))}function Xt(t){var n=0,r=0;return function(){var e=Me(),u=Dn-(e-r);if(r=e,u>0){if(++n>=Rn)return arguments[0]}else n=0;return t.apply(In,arguments)}}function Yt(t){if(typeof t=="string"||bn(t))return t;
|
|
26
|
+
var n=t+"";return"0"==n&&1/t==-Nn?"-0":n}function Zt(t){if(null!=t){try{return ye.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function tn(t){return(null==t?0:t.length)?H(t,1):[]}function nn(t){var n=null==t?0:t.length;return n?t[n-1]:In}function rn(t){if(null==t)return 0;if(fn(t))return vn(t)?h(t):t.length;var n=nu(t);return n==Yn||n==or?t.size:ut(t).length}function en(t,n){if(typeof t!="function"||null!=n&&typeof n!="function")throw new TypeError(Ln);var r=function(){var e=arguments,u=n?n.apply(this,e):e[0],o=r.cache;
|
|
27
|
+
if(o.has(u))return o.get(u);var i=t.apply(this,e);return r.cache=o.set(u,i)||o,i};return r.cache=new(en.Cache||S),r}function un(t){return G(t,Cn)}function on(t){return G(t,Un|Cn)}function cn(t,n){return t===n||t!==t&&n!==n}function fn(t){return null!=t&&sn(t.length)&&!ln(t)}function an(t){return pn(t)&&fn(t)}function ln(t){if(!hn(t))return false;var n=Q(t);return n==Qn||n==Xn||n==Gn||n==er}function sn(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Vn}function hn(t){var n=typeof t;return null!=t&&("object"==n||"function"==n);
|
|
28
|
+
}function pn(t){return null!=t&&typeof t=="object"}function yn(t){if(!pn(t)||Q(t)!=nr)return false;var n=Ae(t);if(null===n)return true;var r=ve.call(n,"constructor")&&n.constructor;return typeof r=="function"&&r instanceof r&&ye.call(r)==ge}function vn(t){return typeof t=="string"||!ou(t)&&pn(t)&&Q(t)==ir}function bn(t){return typeof t=="symbol"||pn(t)&&Q(t)==cr}function _n(t){return mt(t,mn(t))}function gn(t){return null==t?"":pt(t)}function dn(t,n,r){var e=null==t?In:J(t,n);return e===In?r:e}function jn(t,n){
|
|
29
|
+
return null!=t&&Mt(t,n,X)}function wn(t,n){return null!=t&&Mt(t,n,Y)}function On(t){return fn(t)?C(t):ut(t)}function mn(t){return fn(t)?C(t,true):ot(t)}function An(t,n,r){return null==t?t:st(t,n,r)}function zn(t,n){return null==t||yt(t,n)}function xn(t){return function(){return t}}function Sn(t){return t}function kn(){return[]}function En(){return false}function Pn(t){return ou(t)?e(t,Yt):bn(t)?[t]:Ot(eu(gn(t)))}var In,$n="4.17.5",Fn=200,Ln="Expected a function",Mn="__lodash_hash_undefined__",Tn=500,Un=1,Bn=2,Cn=4,Rn=800,Dn=16,Nn=1/0,Vn=9007199254740991,Wn="[object Arguments]",qn="[object Array]",Gn="[object AsyncFunction]",Hn="[object Boolean]",Jn="[object Date]",Kn="[object Error]",Qn="[object Function]",Xn="[object GeneratorFunction]",Yn="[object Map]",Zn="[object Number]",tr="[object Null]",nr="[object Object]",rr="[object Promise]",er="[object Proxy]",ur="[object RegExp]",or="[object Set]",ir="[object String]",cr="[object Symbol]",fr="[object Undefined]",ar="[object WeakMap]",lr="[object ArrayBuffer]",sr="[object DataView]",hr="[object Float32Array]",pr="[object Float64Array]",yr="[object Int8Array]",vr="[object Int16Array]",br="[object Int32Array]",_r="[object Uint8Array]",gr="[object Uint8ClampedArray]",dr="[object Uint16Array]",jr="[object Uint32Array]",wr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Or=/^\w*$/,mr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ar=/[\\^$.*+?()[\]{}|]/g,zr=/\\(\\)?/g,xr=/\w*$/,Sr=/^\[object .+?Constructor\]$/,kr=/^(?:0|[1-9]\d*)$/,Er="\\ud800-\\udfff",Pr="\\u0300-\\u036f",Ir="\\ufe20-\\ufe2f",$r="\\u20d0-\\u20ff",Fr=Pr+Ir+$r,Lr="\\ufe0e\\ufe0f",Mr="["+Er+"]",Tr="["+Fr+"]",Ur="\\ud83c[\\udffb-\\udfff]",Br="(?:"+Tr+"|"+Ur+")",Cr="[^"+Er+"]",Rr="(?:\\ud83c[\\udde6-\\uddff]){2}",Dr="[\\ud800-\\udbff][\\udc00-\\udfff]",Nr="\\u200d",Vr=Br+"?",Wr="["+Lr+"]?",qr="(?:"+Nr+"(?:"+[Cr,Rr,Dr].join("|")+")"+Wr+Vr+")*",Gr=Wr+Vr+qr,Hr="(?:"+[Cr+Tr+"?",Tr,Rr,Dr,Mr].join("|")+")",Jr=RegExp(Ur+"(?="+Ur+")|"+Hr+Gr,"g"),Kr=RegExp("["+Nr+Er+Fr+Lr+"]"),Qr={};
|
|
30
|
+
Qr[hr]=Qr[pr]=Qr[yr]=Qr[vr]=Qr[br]=Qr[_r]=Qr[gr]=Qr[dr]=Qr[jr]=true,Qr[Wn]=Qr[qn]=Qr[lr]=Qr[Hn]=Qr[sr]=Qr[Jn]=Qr[Kn]=Qr[Qn]=Qr[Yn]=Qr[Zn]=Qr[nr]=Qr[ur]=Qr[or]=Qr[ir]=Qr[ar]=false;var Xr={};Xr[Wn]=Xr[qn]=Xr[lr]=Xr[sr]=Xr[Hn]=Xr[Jn]=Xr[hr]=Xr[pr]=Xr[yr]=Xr[vr]=Xr[br]=Xr[Yn]=Xr[Zn]=Xr[nr]=Xr[ur]=Xr[or]=Xr[ir]=Xr[cr]=Xr[_r]=Xr[gr]=Xr[dr]=Xr[jr]=true,Xr[Kn]=Xr[Qn]=Xr[ar]=false;var Yr=typeof global=="object"&&global&&global.Object===Object&&global,Zr=typeof self=="object"&&self&&self.Object===Object&&self,te=Yr||Zr||Function("return this")(),ne=typeof exports=="object"&&exports&&!exports.nodeType&&exports,re=ne&&typeof module=="object"&&module&&!module.nodeType&&module,ee=re&&re.exports===ne,ue=ee&&Yr.process,oe=function(){
|
|
31
|
+
try{return ue&&ue.binding&&ue.binding("util")}catch(t){}}(),ie=oe&&oe.isMap,ce=oe&&oe.isSet,fe=oe&&oe.isTypedArray,ae=o("length"),le=Array.prototype,se=Function.prototype,he=Object.prototype,pe=te["__core-js_shared__"],ye=se.toString,ve=he.hasOwnProperty,be=function(){var t=/[^.]+$/.exec(pe&&pe.keys&&pe.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),_e=he.toString,ge=ye.call(Object),de=RegExp("^"+ye.call(ve).replace(Ar,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),je=ee?te.Buffer:In,we=te.Symbol,Oe=te.Uint8Array,me=je?je.allocUnsafe:In,Ae=l(Object.getPrototypeOf,Object),ze=Object.create,xe=he.propertyIsEnumerable,Se=le.splice,ke=we?we.isConcatSpreadable:In,Ee=we?we.toStringTag:In,Pe=function(){
|
|
32
|
+
try{var t=Ft(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),Ie=Object.getOwnPropertySymbols,$e=je?je.isBuffer:In,Fe=l(Object.keys,Object),Le=Math.max,Me=Date.now,Te=Ft(te,"DataView"),Ue=Ft(te,"Map"),Be=Ft(te,"Promise"),Ce=Ft(te,"Set"),Re=Ft(te,"WeakMap"),De=Ft(Object,"create"),Ne=Zt(Te),Ve=Zt(Ue),We=Zt(Be),qe=Zt(Ce),Ge=Zt(Re),He=we?we.prototype:In,Je=He?He.valueOf:In,Ke=He?He.toString:In,Qe=function(){function t(){}return function(n){if(!hn(n))return{};if(ze)return ze(n);t.prototype=n;
|
|
33
|
+
var r=new t;return t.prototype=In,r}}();v.prototype.clear=b,v.prototype.delete=_,v.prototype.get=g,v.prototype.has=d,v.prototype.set=j,w.prototype.clear=O,w.prototype.delete=m,w.prototype.get=A,w.prototype.has=z,w.prototype.set=x,S.prototype.clear=k,S.prototype.delete=E,S.prototype.get=P,S.prototype.has=I,S.prototype.set=$,F.prototype.clear=L,F.prototype.delete=M,F.prototype.get=T,F.prototype.has=U,F.prototype.set=B;var Xe=St(),Ye=Pe?function(t,n){return Pe(t,"toString",{configurable:true,enumerable:false,
|
|
34
|
+
value:xn(n),writable:true})}:Sn,Ze=Ie?function(t){return null==t?[]:(t=Object(t),r(Ie(t),function(n){return xe.call(t,n)}))}:kn,tu=Ie?function(t){for(var n=[];t;)u(n,Ze(t)),t=Ae(t);return n}:kn,nu=Q;(Te&&nu(new Te(new ArrayBuffer(1)))!=sr||Ue&&nu(new Ue)!=Yn||Be&&nu(Be.resolve())!=rr||Ce&&nu(new Ce)!=or||Re&&nu(new Re)!=ar)&&(nu=function(t){var n=Q(t),r=n==nr?t.constructor:In,e=r?Zt(r):"";if(e)switch(e){case Ne:return sr;case Ve:return Yn;case We:return rr;case qe:return or;case Ge:return ar}return n;
|
|
35
|
+
});var ru=Xt(Ye),eu=Gt(function(t){var n=[];return 46===t.charCodeAt(0)&&n.push(""),t.replace(mr,function(t,r,e,u){n.push(e?u.replace(zr,"$1"):r||t)}),n});en.Cache=S;var uu=Z(function(){return arguments}())?Z:function(t){return pn(t)&&ve.call(t,"callee")&&!xe.call(t,"callee")},ou=Array.isArray,iu=$e||En,cu=ie?c(ie):tt,fu=ce?c(ce):rt,au=fe?c(fe):et,lu=xt(function(t,n,r){it(t,n,r)}),su=xt(function(t,n,r,e){it(t,n,r,e)}),hu=Et(function(t,n){var r={};if(null==t)return r;var u=false;n=e(n,function(n){return n=vt(n,t),
|
|
36
|
+
u||(u=n.length>1),n}),mt(t,It(t),r),u&&(r=G(r,Un|Bn|Cn,kt));for(var o=n.length;o--;)yt(r,n[o]);return r}),pu=Et(function(t,n){return null==t?{}:ft(t,n)});y.constant=xn,y.flatten=tn,y.keys=On,y.keysIn=mn,y.memoize=en,y.merge=lu,y.mergeWith=su,y.omit=hu,y.pick=pu,y.set=An,y.toPath=Pn,y.toPlainObject=_n,y.unset=zn,y.clone=un,y.cloneDeep=on,y.eq=cn,y.get=dn,y.has=jn,y.hasIn=wn,y.identity=Sn,y.isArguments=uu,y.isArray=ou,y.isArrayLike=fn,y.isArrayLikeObject=an,y.isBuffer=iu,y.isFunction=ln,y.isLength=sn,
|
|
37
|
+
y.isMap=cu,y.isObject=hn,y.isObjectLike=pn,y.isPlainObject=yn,y.isSet=fu,y.isString=vn,y.isSymbol=bn,y.isTypedArray=au,y.last=nn,y.stubArray=kn,y.stubFalse=En,y.size=rn,y.toString=gn,y.VERSION=$n,typeof define=="function"&&typeof define.amd=="object"&&define.amd?(te._=y, define(function(){return y})):re?((re.exports=y)._=y,ne._=y):te._=y}).call(this);
|
package/build/src/assert.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
declare function assert(value: unknown, message?: string): asserts value;
|
|
2
|
-
declare function assertUnreachable(x?: never): never;
|
|
3
|
-
declare function assertNotNull<T>(value: T | null): asserts value is Exclude<T, null>;
|
|
4
|
-
|
|
5
|
-
export { assert, assertNotNull, assertUnreachable };
|
|
1
|
+
export declare function assert(value: unknown, message?: string): asserts value;
|
|
2
|
+
export declare function assertUnreachable(x?: never): never;
|
|
3
|
+
export declare function assertNotNull<T>(value: T | null): asserts value is Exclude<T, null>;
|
package/build/src/assert.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/assert.ts"],"sourcesContent":["/*\n * @poppinss/utils\n *\n * (c) Poppinss\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\nexport function assert(value: unknown, message?: string): asserts value {\n if (!value) {\n throw new Error(message ?? 'value is falsy')\n }\n}\n\nexport function assertUnreachable(x?: never): never {\n throw new Error(`unreachable code executed: ${String(x)}`)\n}\n\nexport function assertNotNull<T>(value: T | null): asserts value is Exclude<T, null> {\n if (value === null) {\n throw new Error('unexpected null value')\n }\n}\n"],"mappings":";AASO,SAAS,OAAO,OAAgB,SAAiC;AACtE,MAAI,CAAC,OAAO;AACV,UAAM,IAAI,MAAM,WAAW,gBAAgB;AAAA,EAC7C;AACF;AAEO,SAAS,kBAAkB,GAAkB;AAClD,QAAM,IAAI,MAAM,8BAA8B,OAAO,CAAC,CAAC,EAAE;AAC3D;AAEO,SAAS,cAAiB,OAAoD;AACnF,MAAI,UAAU,MAAM;AAClB,UAAM,IAAI,MAAM,uBAAuB;AAAA,EACzC;AACF;","names":[]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
+
/**
|
|
3
|
+
* Helper class to base64 encode/decode values with option
|
|
4
|
+
* for url encoding and decoding
|
|
5
|
+
*/
|
|
6
|
+
declare class Base64 {
|
|
7
|
+
/**
|
|
8
|
+
* Base64 encode Buffer or string
|
|
9
|
+
*/
|
|
10
|
+
encode(arrayBuffer: ArrayBuffer | SharedArrayBuffer): string;
|
|
11
|
+
encode(data: string, encoding?: BufferEncoding): string;
|
|
12
|
+
/**
|
|
13
|
+
* Base64 decode a previously encoded string or Buffer.
|
|
14
|
+
*/
|
|
15
|
+
decode(encode: string, encoding: BufferEncoding, strict: true): string;
|
|
16
|
+
decode(encode: string, encoding: undefined, strict: true): string;
|
|
17
|
+
decode(encode: string, encoding?: BufferEncoding, strict?: false): string | null;
|
|
18
|
+
decode(encode: Buffer, encoding?: BufferEncoding): string;
|
|
19
|
+
/**
|
|
20
|
+
* Base64 encode Buffer or string to be URL safe. (RFC 4648)
|
|
21
|
+
*/
|
|
22
|
+
urlEncode(arrayBuffer: ArrayBuffer | SharedArrayBuffer): string;
|
|
23
|
+
urlEncode(data: string, encoding?: BufferEncoding): string;
|
|
24
|
+
/**
|
|
25
|
+
* Base64 URL decode a previously encoded string or Buffer. (RFC 4648)
|
|
26
|
+
*/
|
|
27
|
+
urlDecode(encode: string, encoding: BufferEncoding, strict: true): string;
|
|
28
|
+
urlDecode(encode: string, encoding: undefined, strict: true): string;
|
|
29
|
+
urlDecode(encode: string, encoding?: BufferEncoding, strict?: false): string | null;
|
|
30
|
+
urlDecode(encode: Buffer, encoding?: BufferEncoding): string;
|
|
31
|
+
}
|
|
32
|
+
export declare const base64: Base64;
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Constructor } from './types.js';
|
|
2
|
+
interface UnaryFunction<T, R> {
|
|
3
|
+
(source: T): R;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Compose a class by applying mixins to it.
|
|
7
|
+
* The code is inspired by https://justinfagnani.com/2015/12/21/real-mixins-with-javascript-classes/, its
|
|
8
|
+
* just that I have added the support for static types too.
|
|
9
|
+
*/
|
|
10
|
+
export declare function compose<T extends Constructor, A>(superclass: T, mixin: UnaryFunction<T, A>): A;
|
|
11
|
+
export declare function compose<T extends Constructor, A, B>(superclass: T, mixin: UnaryFunction<T, A>, mixinB: UnaryFunction<A, B>): B;
|
|
12
|
+
export declare function compose<T extends Constructor, A, B, C>(superclass: T, mixin: UnaryFunction<T, A>, mixinB: UnaryFunction<A, B>, mixinC: UnaryFunction<B, C>): C;
|
|
13
|
+
export declare function compose<T extends Constructor, A, B, C, D>(superclass: T, mixin: UnaryFunction<T, A>, mixinB: UnaryFunction<A, B>, mixinC: UnaryFunction<B, C>, mixinD: UnaryFunction<C, D>): D;
|
|
14
|
+
export declare function compose<T extends Constructor, A, B, C, D, E>(superclass: T, mixin: UnaryFunction<T, A>, mixinB: UnaryFunction<A, B>, mixinC: UnaryFunction<B, C>, mixinD: UnaryFunction<C, D>, mixinE: UnaryFunction<D, E>): E;
|
|
15
|
+
export declare function compose<T extends Constructor, A, B, C, D, E, F>(superclass: T, mixin: UnaryFunction<T, A>, mixinB: UnaryFunction<A, B>, mixinC: UnaryFunction<B, C>, mixinD: UnaryFunction<C, D>, mixinF: UnaryFunction<E, F>): F;
|
|
16
|
+
export declare function compose<T extends Constructor, A, B, C, D, E, F, G>(superclass: T, mixin: UnaryFunction<T, A>, mixinB: UnaryFunction<A, B>, mixinC: UnaryFunction<B, C>, mixinD: UnaryFunction<C, D>, mixinF: UnaryFunction<E, F>, mixinG: UnaryFunction<F, G>): G;
|
|
17
|
+
export declare function compose<T extends Constructor, A, B, C, D, E, F, G, H>(superclass: T, mixin: UnaryFunction<T, A>, mixinB: UnaryFunction<A, B>, mixinC: UnaryFunction<B, C>, mixinD: UnaryFunction<C, D>, mixinF: UnaryFunction<E, F>, mixinG: UnaryFunction<F, G>, mixinH: UnaryFunction<G, H>): H;
|
|
18
|
+
export declare function compose<T extends Constructor, A, B, C, D, E, F, G, H, I>(superclass: T, mixin: UnaryFunction<T, A>, mixinB: UnaryFunction<A, B>, mixinC: UnaryFunction<B, C>, mixinD: UnaryFunction<C, D>, mixinF: UnaryFunction<E, F>, mixinG: UnaryFunction<F, G>, mixinH: UnaryFunction<G, H>, mixinI: UnaryFunction<H, I>): I;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
type Constructor = new (...args: any[]) => any;
|
|
2
|
+
type AbstractConstructor = abstract new (...args: any[]) => any;
|
|
3
|
+
/**
|
|
4
|
+
* Define static properties on a class with inheritance in play.
|
|
5
|
+
*/
|
|
6
|
+
export declare function defineStaticProperty<T extends Constructor | AbstractConstructor, Prop extends keyof T>(self: T, propertyName: Prop, { initialValue, strategy, }: {
|
|
7
|
+
initialValue: T[Prop];
|
|
8
|
+
strategy: 'inherit' | 'define' | ((value: T[Prop]) => T[Prop]);
|
|
9
|
+
}): void;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extended Error object with the option to set error `status` and `code`.
|
|
3
|
+
* At AdonisJs, we prefer exceptions with proper error codes to handle
|
|
4
|
+
* them without relying on message pattern matching.
|
|
5
|
+
*
|
|
6
|
+
* ```js
|
|
7
|
+
* new Exception('message', 500, 'E_RUNTIME_EXCEPTION')
|
|
8
|
+
* ```
|
|
9
|
+
*/
|
|
10
|
+
export declare class Exception extends Error {
|
|
11
|
+
/**
|
|
12
|
+
* Static properties to defined on the exception once
|
|
13
|
+
* and then re-use them
|
|
14
|
+
*/
|
|
15
|
+
static help?: string;
|
|
16
|
+
static code?: string;
|
|
17
|
+
static status?: number;
|
|
18
|
+
static message?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Name of the class that raised the exception.
|
|
21
|
+
*/
|
|
22
|
+
name: string;
|
|
23
|
+
/**
|
|
24
|
+
* Optional help description for the error. You can use it to define additional
|
|
25
|
+
* human readable information for the error.
|
|
26
|
+
*/
|
|
27
|
+
help?: string;
|
|
28
|
+
/**
|
|
29
|
+
* A machine readable error code. This will allow the error handling logic
|
|
30
|
+
* to narrow down exceptions based upon the error code.
|
|
31
|
+
*/
|
|
32
|
+
code?: string;
|
|
33
|
+
/**
|
|
34
|
+
* A status code for the error. Usually helpful when converting errors
|
|
35
|
+
* to HTTP responses.
|
|
36
|
+
*/
|
|
37
|
+
status: number;
|
|
38
|
+
constructor(message?: string, options?: ErrorOptions & {
|
|
39
|
+
code?: string;
|
|
40
|
+
status?: number;
|
|
41
|
+
});
|
|
42
|
+
get [Symbol.toStringTag](): string;
|
|
43
|
+
toString(): string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Helper to create anonymous error classes
|
|
47
|
+
*/
|
|
48
|
+
export declare function createError<T extends any[] = never>(message: string, code: string, status?: number): typeof Exception & T extends never ? {
|
|
49
|
+
new (args?: any, options?: ErrorOptions): Exception;
|
|
50
|
+
} : {
|
|
51
|
+
new (args: T, options?: ErrorOptions): Exception;
|
|
52
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
+
import { ImportAllFilesOptions } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Returns an array of file paths from the given location. You can
|
|
5
|
+
* optionally filter and sort files by passing relevant options
|
|
6
|
+
*
|
|
7
|
+
* ```ts
|
|
8
|
+
* await fsReadAll(new URL('./', import.meta.url))
|
|
9
|
+
*
|
|
10
|
+
* await fsReadAll(new URL('./', import.meta.url), {
|
|
11
|
+
* filter: (filePath) => filePath.endsWith('.js')
|
|
12
|
+
* })
|
|
13
|
+
|
|
14
|
+
* await fsReadAll(new URL('./', import.meta.url), {
|
|
15
|
+
* absolute: true,
|
|
16
|
+
* unixPaths: true
|
|
17
|
+
* })
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare function fsImportAll(location: string | URL, options?: ImportAllFilesOptions): Promise<any>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
+
import { ReadAllFilesOptions } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Returns an array of file paths from the given location. You can
|
|
5
|
+
* optionally filter and sort files by passing relevant options
|
|
6
|
+
*
|
|
7
|
+
* ```ts
|
|
8
|
+
* await fsReadAll(new URL('./', import.meta.url))
|
|
9
|
+
*
|
|
10
|
+
* await fsReadAll(new URL('./', import.meta.url), {
|
|
11
|
+
* filter: (filePath) => filePath.endsWith('.js')
|
|
12
|
+
* })
|
|
13
|
+
|
|
14
|
+
* await fsReadAll(new URL('./', import.meta.url), {
|
|
15
|
+
* absolute: true,
|
|
16
|
+
* unixPaths: true
|
|
17
|
+
* })
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare function fsReadAll(location: string | URL, options?: ReadAllFilesOptions): Promise<string[]>;
|
package/build/src/json/main.d.ts
CHANGED
|
@@ -1,19 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* A drop-in replacement for JSON.parse with prototype poisoning protection.
|
|
5
|
-
*/
|
|
6
|
-
declare function safeParse(jsonString: string, reviver?: JSONReviver): any;
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* String Javascript values to a JSON string. Handles circular
|
|
10
|
-
* references and bigints
|
|
11
|
-
*/
|
|
12
|
-
declare function safeStringify(value: any, replacer?: JSONReplacer, space?: string | number): string | undefined;
|
|
13
|
-
|
|
1
|
+
import { safeParse } from './safe_parse.js';
|
|
2
|
+
import { safeStringify } from './safe_stringify.js';
|
|
14
3
|
declare const json: {
|
|
15
4
|
safeParse: typeof safeParse;
|
|
16
5
|
safeStringify: typeof safeStringify;
|
|
17
6
|
};
|
|
18
|
-
|
|
19
|
-
export { json as default };
|
|
7
|
+
export default json;
|
package/build/src/json/main.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Message builder exposes an API to "JSON.stringify" values by
|
|
3
|
+
* encoding purpose and expiry date inside them.
|
|
4
|
+
*
|
|
5
|
+
* The return value must be further encrypted to prevent tempering.
|
|
6
|
+
*/
|
|
7
|
+
export declare class MessageBuilder {
|
|
8
|
+
#private;
|
|
9
|
+
/**
|
|
10
|
+
* Builds a message by encoding expiry date and purpose inside it.
|
|
11
|
+
*/
|
|
12
|
+
build(message: any, expiresIn?: string | number, purpose?: string): string;
|
|
13
|
+
/**
|
|
14
|
+
* Verifies the message for expiry and purpose.
|
|
15
|
+
*/
|
|
16
|
+
verify<T extends any>(message: any, purpose?: string): null | T;
|
|
17
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { OmitProperties } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* A simple class to build an object incrementally. It is helpful when you
|
|
4
|
+
* want to add properties to the object conditionally.
|
|
5
|
+
*
|
|
6
|
+
* Instead of writing
|
|
7
|
+
* ```
|
|
8
|
+
* const obj = {
|
|
9
|
+
* ...(user.id ? { id: user.id } : {}),
|
|
10
|
+
* ...(user.firstName && user.lastName ? { name: `${user.firstName} ${user.lastName}` } : {}),
|
|
11
|
+
* }
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* You can write
|
|
15
|
+
*
|
|
16
|
+
* const obj = new ObjectBuilder()
|
|
17
|
+
* .add('id', user.id)
|
|
18
|
+
* .add(
|
|
19
|
+
* 'fullName',
|
|
20
|
+
* user.firstName && user.lastName ? `${user.firstName} ${user.lastName}` : undefined
|
|
21
|
+
* )
|
|
22
|
+
* .toObject()
|
|
23
|
+
*/
|
|
24
|
+
export declare class ObjectBuilder<ReturnType extends Record<string, any>, IgnoreNull extends boolean = false> {
|
|
25
|
+
#private;
|
|
26
|
+
values: ReturnType;
|
|
27
|
+
constructor(initialValue: ReturnType, ignoreNull?: IgnoreNull);
|
|
28
|
+
/**
|
|
29
|
+
* Add a key-value pair to the object
|
|
30
|
+
*
|
|
31
|
+
* - Undefined values are ignored
|
|
32
|
+
* - Null values are ignored, when `ignoreNull` is set to true
|
|
33
|
+
*/
|
|
34
|
+
add<Prop extends string>(key: Prop, value: undefined): this;
|
|
35
|
+
add<Prop extends string, Value>(key: Prop, value: Value): ObjectBuilder<ReturnType & {
|
|
36
|
+
[P in Prop]: Value;
|
|
37
|
+
}, IgnoreNull>;
|
|
38
|
+
/**
|
|
39
|
+
* Remove key from the object
|
|
40
|
+
*/
|
|
41
|
+
remove<K extends keyof ReturnType>(key: K): this;
|
|
42
|
+
/**
|
|
43
|
+
* Find if a value exists
|
|
44
|
+
*/
|
|
45
|
+
has<K extends keyof ReturnType>(key: K): boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Get the existing value for a given key
|
|
48
|
+
*/
|
|
49
|
+
get<K extends keyof ReturnType>(key: K): ReturnType[K];
|
|
50
|
+
/**
|
|
51
|
+
* Get the underlying constructed object
|
|
52
|
+
*/
|
|
53
|
+
toObject(): IgnoreNull extends true ? {
|
|
54
|
+
[K in keyof OmitProperties<ReturnType, null>]: ReturnType[K];
|
|
55
|
+
} : {
|
|
56
|
+
[K in keyof ReturnType]: ReturnType[K];
|
|
57
|
+
};
|
|
58
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
type BufferSafeValue = ArrayBuffer | SharedArrayBuffer | number[] | string | {
|
|
2
|
+
valueOf(): string | object;
|
|
3
|
+
} | {
|
|
4
|
+
[Symbol.toPrimitive](hint: 'string'): string;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Compare two values to see if they are equal. The comparison is done in
|
|
8
|
+
* a way to avoid timing-attacks.
|
|
9
|
+
*/
|
|
10
|
+
export declare function safeEqual<T extends BufferSafeValue, U extends BufferSafeValue>(trustedValue: T, userInput: U): boolean;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as slash } from 'slash';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BytesOptions } from 'bytes';
|
|
2
|
+
declare const _default: {
|
|
3
|
+
format(valueInBytes: number, options?: BytesOptions): string;
|
|
4
|
+
/**
|
|
5
|
+
* Parse the unit expression to bytes. If the unit value
|
|
6
|
+
* is a number, then it will be returned as it is considering
|
|
7
|
+
* it is already in bytes.
|
|
8
|
+
*/
|
|
9
|
+
parse(unit: string | number): number;
|
|
10
|
+
};
|
|
11
|
+
export default _default;
|