pepka 1.0.0-beta.8 → 1.0.0

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/dist/bundle.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";const e=Symbol("Placeholder"),r=r=>{let t=0;for(const s of r)s!==e&&t++;return t},t=(r,t)=>{const s=r.length,o=r.slice(),p=t.length;let n=p,c=0;for(;n&&c<s;c++)o[c]===e&&(o[c]=t[p-n],n--);for(c=s;n;c++,n--)o[c]=t[p-n];return o},s=(e,o,p)=>{const n=e.length-o.length-r(p);if(n<1)return e(...t(o,p));{const r=(...r)=>s(e,t(o,p),r);return r.$args_left=n,r}},o=e=>(...t)=>e.length>r(t)?s(e,[],t):e(...t),p=r=>function(t){return t===e?r:r(t)};function n(r){return function(t,s){const o=t===e,n=arguments.length;if(1===n&&o)throw new Error("Senseless placeholder usage.");return arguments.length>1?o?p((e=>r(e,s))):r(t,s):e=>r(t,e)}}function c(e){return o(e)}const x=void 0,a=1/0,i=e=>typeof e,l=e=>null===e,u=e=>"number"==i(e),f=e=>Array.isArray(e),h=e=>"function"===i(e),m={u:"U",b:"B",n:"N",s:"S",f:"F"},y=e=>{const r=i(e);return"object"===r?l(e)?"Null":e.constructor.name:m[r[0]]+r.slice(1)},d=n(((e,r)=>y(r)===e)),g=n(((e,r)=>(r.push(e),r))),b=c(((e,r,t)=>(t[e]=r,t))),w=c(((e,r,t)=>t.reduce(e,r))),j=c(((e,r,t)=>{for(let s in t)switch(y(t[s])){case"Array":if(e>1&&"Array"===y(r[s]))switch(e){case 2:const o=r[s],p=t[s];for(const r in p)o[r]?j(e,o[r],p[r]):o[r]=p[r];break;case 3:r[s].push(...t[s])}else r[s]=t[s];break;case"Object":if("Object"===y(r[s])){j(e,r[s],t[s]);break}default:r[s]=t[s]}return r})),O=j(1),q=j(2),A=j(3),E=n(((e,r)=>Object.assign(e,r))),S=n(((e,r)=>{let t,s,o,p;for(t in e)t in r&&(s=e[t],[o,p]=h(s)?s(r[t],t,r):[s||t,r[t]],r[o]=p,t!==o&&delete r[t]);return r})),k=n(((e,r)=>{for(let t in r)r[t]=e(r[t],+t,r);return r})),v=n(((e,r)=>{const t=f(r);let s,o;t&&(s=0,o=[]);for(let s in r)e(r[s],s)||(t?o.push(+s):delete r[s]);if(t)for(const e of o)r.splice(e-s++,1);return r})),P=e=>(...r)=>r[e],D=n(((e,r)=>{const t=y(e);if(t===y(r)&&("Object"===t||"Array"==t)){if(l(e)||l(r))return e===r;if(e===r)return!0;for(const t of[e,r])for(const s in t)if(!(t===r&&s in e||t===e&&s in r&&D(e[s],r[s])))return!1;return!0}return e===r})),z=o(((e,r,t,s)=>e(s)?r(s):t(s))),N=c(((e,r,t)=>z(e,r,te,t))),B=(...r)=>(...t)=>{let s,o=!0;for(let p=ee(r)-1;p>-1;p--)o?(o=!1,s=r[p](...t)):s=s===e?r[p]():r[p](s);return s},_=n(((e,r)=>e.bind(r))),C=n(((e,r)=>r[e])),I=n(((e,r)=>{if((e=>"string"===i(e))(r))return r.includes(e);for(const t of r)if(D(t,e))return!0;return!1})),T=c(((e,r,t)=>t.slice(e,u(r)?r:a))),U=e=>n(((r,t)=>e(t,r))),$=C(0),F=T(1,a),K=n(((e,r)=>e+r)),L=n(((e,r)=>r-e)),W=n(((e,r)=>e*r)),X=n(((e,r)=>e>r)),G=n(((e,r)=>e<r)),H=n(((e,r)=>r>=e)),J=n(((e,r)=>r<=e)),M=n(((e,r)=>r.sort(e))),Q=n(((e,r)=>r.find(e))),R=n(((e,r)=>r.findIndex(e))),V=n(((e,r)=>R(D(e),r))),Y=n(((e,r)=>e/r)),Z=e=>l(e)||(e=>e===x)(e),ee=e=>e.length,re=e=>()=>e,te=e=>e,se=e=>!e,oe=n(((e,r)=>e.test(r))),pe=n(((e,r)=>(e(r),r))),ne=n(((e,r)=>[...r,e])),ce=n(((e,r)=>r.split(e))),xe=re(!0),ae=re(!1),ie=n(((e,r)=>r(...e))),le=e=>(...r)=>{const t=e(...r),s=h(t);return!s||s&&t.$args_left<=0?se(t):le(t)},ue=n(((e,r)=>he(K(e),r-e))),fe=n(((e,r)=>e.filter(U(I)(r)))),he=n(((e,r)=>[...Array(r)].map(((r,t)=>e(t))))),me=n(((e,r)=>{for(const[t,s]of e)if(t(r))return s(r)})),ye=c(((e,r,t)=>({...t,[e]:r}))),de=c(((e,r,t)=>B((s=>{return ye(s,ee(e)<2?r:de(T(1,a,e),r,(o=t[s],l(o)||"object"!==i(o)?{}:t[s])),t);var o}),$)(e))),ge=n(((e,r)=>r.every(e))),be=n(((e,r)=>r.some(e))),we=n(((e,r)=>e.every((e=>e(r))))),je=n(((e,r)=>e.some((e=>e(r))))),Oe=n(((e,r)=>r[e])),qe=c(((e,r,t)=>D(t[e],r))),Ae=c(((e,r,t)=>D(r[e],t[e]))),Ee=c(((e,r,t)=>z(ee,(()=>Z(t)?e:B(z(Z,re(e),(t=>Ee(e,T(1,a,r),t))),U(Oe)(t),$)(r)),re(t),r))),Se=Ee(x),ke=c(((e,r,t)=>D(Se(e,t),r))),ve=c(((e,r,t)=>D(Se(e,r),Se(e,t)))),Pe=/^(.*?)(8|16|32|64)(Clamped)?Array$/,De=(e,r=!1)=>{const t=y(e);switch(t){case"Null":case"String":case"Number":case"Boolean":case"Symbol":return e;case"Array":return r?[...e]:Te(B(De,P(0)),e);case"Object":if(r)return{...e};const s={};for(let r in e)s[r]=De(e[r]);return s;default:return Pe.test(t)?e.constructor.from(e):e}},ze=c(((e,r,t)=>w(e,De(r),t))),Ne=n(((e,r)=>Ke(e,r))),Be=n(((e,r)=>{const t={};for(const s of e)s in r&&(t[s]=r[s]);return t})),_e=n(((e,r)=>Ke(((r,t)=>!I(t,e)),r))),Ce=n(((e,r)=>r.concat(e))),Ie=n(((e,r)=>r.join(e))),Te=n(((e,r)=>r.map(e))),Ue=n(((e,r)=>r.forEach(e))),$e=c(((e,r,t)=>r(t)&&e(t))),Fe=c(((e,r,t)=>t.replace(e,r))),Ke=n(((e,r)=>f(r)?r.filter(e):v(e,{...r}))),Le=n(((e,r)=>Object.assign({},e,r))),We=n(((e,r)=>O(De(e),De(r)))),Xe=n(((e,r)=>q(De(e),De(r)))),Ge=n(((e,r)=>A(De(e),De(r)))),He=c(((e,r,t)=>ye(e,r(t[e]),t))),Je=n(((e,r)=>S(e,Object.assign({},r)))),Me=n(((e,r)=>Te(((e,t)=>[e,r[t]]),e))),Qe=n(((e,r)=>ze(((e,t,s)=>ye(t,r[s],e)),{},e))),Re=c(((e,r,t)=>Te(((r,s)=>e(r,t[s])),r))),Ve=(()=>{const e=async(r,t,s)=>{s<t.length&&(await r(t[s]),await e(r,t,++s))};return n(((r,t)=>e(r,t,0)))})(),Ye=n((async(e,r)=>(await e(r),r))),Ze=n(((e,r)=>Promise.all(r.map(e)))),er=(()=>{const e=async(r,t,s)=>~s?await e(r,[await r[s](...t)],--s):$(t);return(...r)=>(...t)=>e(r,t,r.length-1)})(),rr=te,tr=te,sr=te,or=le,pr=ne,nr=be;exports.F=ae,exports.T=xe,exports.__=e,exports.add=K,exports.all=ge,exports.allPass=we,exports.always=re,exports.any=be,exports.anyPass=je,exports.append=ne,exports.assoc=ye,exports.assocPath=de,exports.bind=_,exports.both=$e,exports.callWith=ie,exports.clone=De,exports.cloneShallow=e=>De(e,!0),exports.complement=le,exports.compose=B,exports.composeAsync=er,exports.concat=Ce,exports.cond=me,exports.curry=o,exports.curry2=n,exports.curry3=c,exports.divide=Y,exports.echo=sr,exports.empty=e=>{switch(y(e)){case"String":return"";case"Object":return{};case"Array":return[];default:return x}},exports.equals=D,exports.explore=(e,r="log")=>pe((t=>console[r](e,t))),exports.filter=Ke,exports.find=Q,exports.findIndex=R,exports.flip=U,exports.forEach=Ue,exports.forEachAsync=Ze,exports.forEachSerial=Ve,exports.fromPairs=e=>Object.fromEntries(e),exports.genBy=he,exports.getTmpl=e=>{const r=[],t=[],s=e.length;let o,p,n,c=0,x=0,a=!1,i=$(e),l=!1;for(c=0;c<s;c++)switch(o=e[c],o){case"{":if(!i){a=!0,x=c;break}case"}":if(!i){a=!1,r.push(""),t.push(e.slice(x+1,c));break}default:n=e[c+1],l="\\"===o,a||l&&("{"===n||"}"===n)||(p=r.length-1,p<0&&(r.push(""),p++),r[p]+=o),i=l}return e=>{const s=[],o=r.length-1;for(const p in r)c=+p,s.push(r[c]),c!==o&&s.push(Se(t[c].split("."),e));return s.join("")}},exports.gt=X,exports.gte=H,exports.head=$,exports.identity=te,exports.ifElse=z,exports.includes=I,exports.indexOf=V,exports.intersection=fe,exports.isEmpty=e=>{switch(y(e)){case"String":case"Array":return 0==ee(e);case"Object":for(const r in e)return!1;return!0;default:return null}},exports.isNil=Z,exports.join=Ie,exports.keys=e=>Object.keys(e),exports.last=e=>e[ee(e)-1],exports.length=ee,exports.lt=G,exports.lte=J,exports.map=Te,exports.mapKeys=Je,exports.memoize=e=>{let r,t=!1;return()=>t?r:(t=!0,r=e())},exports.mergeDeep=We,exports.mergeDeepAdd=Ge,exports.mergeDeepX=Xe,exports.mergeShallow=Le,exports.mirror=rr,exports.multiply=W,exports.noop=(...e)=>{},exports.not=se,exports.notf=or,exports.nth=C,exports.omit=_e,exports.once=e=>{let r,t=!1;return(...s)=>t?r:(t=!0,r=e(...s))},exports.overProp=He,exports.path=Se,exports.pathEq=ke,exports.pathOr=Ee,exports.pathsEq=ve,exports.pick=Be,exports.pickBy=Ne,exports.prop=Oe,exports.propEq=qe,exports.propsEq=Ae,exports.push=pr,exports.qappend=g,exports.qassoc=b,exports.qfilter=v,exports.qmap=k,exports.qmapKeys=S,exports.qmergeDeep=O,exports.qmergeDeepAdd=A,exports.qmergeDeepX=q,exports.qmergeShallow=E,exports.qreduce=w,exports.range=ue,exports.reduce=ze,exports.reflect=tr,exports.replace=Fe,exports.reverse=e=>B((r=>ze(((t,s,o)=>g(e[r-o],t)),[],e)),K(-1),ee)(e),exports.sizeof=e=>{if("Object"===y(e)){let r=0;for(let t in e)r++;return r}return ee(e)},exports.slice=T,exports.some=nr,exports.sort=M,exports.split=ce,exports.subtract=L,exports.tail=F,exports.take=P,exports.tap=pe,exports.test=oe,exports.toLower=e=>e.toLowerCase(),exports.toPairs=e=>Object.entries(e),exports.toUpper=e=>e.toUpperCase(),exports.trim=e=>e.trim(),exports.type=y,exports.typeIs=d,exports.uncurry=e=>(...r)=>w(((e,r)=>e?e(r):e),e,r),exports.uniq=e=>w(((e,r)=>I(r,e)?e:g(r,e)),[],e),exports.values=e=>Object.values(e),exports.waitAll=e=>Promise.all(e),exports.waitTap=Ye,exports.when=N,exports.zip=Me,exports.zipObj=Qe,exports.zipWith=Re;
1
+ "use strict";const e=Symbol("Placeholder"),r=r=>{let t=0;for(const s of r)s!==e&&t++;return t},t=(r,t)=>{const s=r.length,o=r.slice(),p=t.length;let n=p,x=0;for(;n&&x<s;x++)o[x]===e&&(o[x]=t[p-n],n--);for(x=s;n;x++,n--)o[x]=t[p-n];return o},s=(e,o,p)=>{const n=e.length-o.length-r(p);if(n<1)return e(...t(o,p));{const r=(...r)=>s(e,t(o,p),r);return r.$args_left=n,r}},o=e=>(...t)=>e.length>r(t)?s(e,[],t):e(...t);function p(r){return function(t,s){const o=t===e;if(1===arguments.length&&o)throw new Error("Senseless placeholder usage.");return arguments.length>1?o?(r=>function(t){return t===e?r:r(t)})((e=>r(e,s))):r(t,s):e=>r(t,e)}}function n(e){return o(e)}const x=void 0,c=1/0,a=e=>typeof e,l=e=>null===e,i=e=>"number"==a(e),u=e=>Array.isArray(e),f=e=>"function"===a(e),h=e=>!l(e)&&"object"===a(e),m={u:"U",b:"B",n:"N",s:"S",f:"F"},d=e=>{const r=a(e);return"object"===r?l(e)?"Null":e.constructor.name:m[r[0]]+r.slice(1)},y=p(((e,r)=>d(r)===e)),g=e=>(...r)=>r[e],b=p(((e,r)=>e===r)),w=p(((e,r)=>e==r)),q=p(((e,r)=>{const t=d(e);if(b(t,d(r))&&(b(t,"Object")||b(t,"Array"))){if(l(e)||l(r))return b(e,r);if(b(e,r))return!0;for(const t of[e,r])for(const s in t)if(!(b(t,r)&&s in e||b(t,e)&&s in r&&q(e[s],r[s])))return!1;return!0}return b(e,r)})),j=o(((e,r,t,s)=>e(s)?r(s):t(s))),O=n(((e,r,t)=>j(e,r,J,t))),A=(...r)=>(...t)=>{let s,o=!0;for(let p=G(r)-1;p>-1;p--)o?(o=!1,s=r[p](...t)):s=s===e?r[p]():r[p](s);return s},S=p(((e,r)=>e.bind(r))),E=p(((e,r)=>r[e])),k=p(((e,r)=>{if((e=>"string"===a(e))(r))return r.includes(e);for(const t of r)if(q(t,e))return!0;return!1})),z=n(((e,r,t)=>t.slice(e,i(r)?r:c))),v=e=>p(((r,t)=>e(t,r))),P=E(0),D=z(1,c),N=p(((e,r)=>e+r)),B=p(((e,r)=>r-e)),T=p(((e,r)=>e*r)),_=p(((e,r)=>e>r)),C=p(((e,r)=>e<r)),F=p(((e,r)=>r>=e)),I=p(((e,r)=>r<=e)),U=p(((e,r)=>r.sort(e))),$=p(((e,r)=>r.find(e))),K=p(((e,r)=>r.findIndex(e))),L=p(((e,r)=>K(q(e),r))),W=p(((e,r)=>e/r)),X=e=>l(e)||(e=>e===x)(e),G=e=>e.length,H=e=>()=>e,J=e=>e,M=e=>!e,Q=p(((e,r)=>e.test(r))),R=p(((e,r)=>(e(r),r))),V=p(((e,r)=>[...r,e])),Y=p(((e,r)=>[...r,e])),Z=p(((e,r)=>r.flat(e))),ee=p(((e,r)=>r.split(e))),re=H(!0),te=H(!1),se=p(((e,r)=>r(...e))),oe=o(((e,r,t)=>t[r](...e))),pe=e=>(...r)=>{const t=e(...r),s=f(t);return!s||s&&t.$args_left<=0?M(t):pe(t)},ne=p(((e,r)=>ce(N(e),r-e))),xe=p(((e,r)=>e.filter(v(k)(r)))),ce=p(((e,r)=>[...Array(r)].map(((r,t)=>e(t))))),ae=p(((e,r)=>{for(const[t,s]of e)if(t(r))return s(r)})),le=n(((e,r,t)=>({...t,[e]:r}))),ie=n(((e,r,t)=>A((s=>le(s,G(e)<2?r:ie(z(1,c,e),r,h(t[s])?t[s]:{}),t)),P)(e))),ue=p(((e,r)=>r.every(e))),fe=p(((e,r)=>r.some(e))),he=p(((e,r)=>e.every((e=>e(r))))),me=p(((e,r)=>e.some((e=>e(r))))),de=p(((e,r)=>r[e])),ye=n(((e,r,t)=>q(t[e],r))),ge=n(((e,r,t)=>q(r[e],t[e]))),be=n(((e,r,t)=>j(G,(()=>X(t)?e:A(j(X,H(e),(t=>be(e,z(1,c,r),t))),v(de)(t),P)(r)),H(t),r))),we=be(x),qe=n(((e,r,t)=>q(we(e,t),r))),je=n(((e,r,t)=>q(we(e,r),we(e,t)))),Oe=/^(.*?)(8|16|32|64)(Clamped)?Array$/,Ae=(e,r=!1)=>{const t=d(e);switch(t){case"Null":case"String":case"Number":case"Boolean":case"Symbol":return e;case"Array":return r?[...e]:De(A(Ae,g(0)),e);case"Object":if(r)return{...e};const s={};for(let r in e)s[r]=Ae(e[r]);return s;default:return Oe.test(t)?e.constructor.from(e):e}},Se=n(((e,r,t)=>sr(e,Ae(r),t))),Ee=p(((e,r)=>_e(e,r))),ke=p(((e,r)=>{const t={};for(const s of e)s in r&&(t[s]=r[s]);return t})),ze=p(((e,r)=>_e(((r,t)=>!k(t,e)),r))),ve=p(((e,r)=>r.concat(e))),Pe=p(((e,r)=>r.join(e))),De=p(((e,r)=>r.map(e))),Ne=p(((e,r)=>r.forEach(e))),Be=n(((e,r,t)=>r(t)&&e(t))),Te=n(((e,r,t)=>t.replace(e,r))),_e=p(((e,r)=>u(r)?r.filter(e):ir(e,{...r}))),Ce=p(((e,r)=>Object.assign({},e,r))),Fe=p(((e,r)=>pr(Ae(e),Ae(r)))),Ie=p(((e,r)=>nr(Ae(e),Ae(r)))),Ue=p(((e,r)=>xr(Ae(e),Ae(r)))),$e=n(((e,r,t)=>le(e,r(t[e]),t))),Ke=p(((e,r)=>ar(e,Object.assign({},r)))),Le=p(((e,r)=>De(((e,t)=>[e,r[t]]),e))),We=p(((e,r)=>Se(((e,t,s)=>le(t,r[s],e)),{},e))),Xe=n(((e,r,t)=>De(((r,s)=>e(r,t[s])),r))),Ge=(()=>{const e=async(r,t,s)=>{s<t.length&&(await r(t[s]),await e(r,t,++s))};return p(((r,t)=>e(r,t,0)))})(),He=p((async(e,r)=>(await e(r),r))),Je=p(((e,r)=>Promise.all(r.map(e)))),Me=(()=>{const e=async(r,t,s)=>~s?await e(r,[await r[s](...t)],--s):P(t);return(...r)=>(...t)=>e(r,t,r.length-1)})(),Qe=J,Re=J,Ve=J,Ye=pe,Ze=V,er=fe,rr=p(((e,r)=>(r.push(e),r))),tr=n(((e,r,t)=>(t[e]=r,t))),sr=n(((e,r,t)=>t.reduce(e,r))),or=n(((e,r,t)=>{for(let s in t)switch(d(t[s])){case"Array":if(e>1&&"Array"===d(r[s]))switch(e){case 2:const o=r[s],p=t[s];for(const r in p)o[r]?or(e,o[r],p[r]):o[r]=p[r];break;case 3:r[s].push(...t[s])}else r[s]=t[s];break;case"Object":if("Object"===d(r[s])){or(e,r[s],t[s]);break}default:r[s]=t[s]}return r})),pr=or(1),nr=or(2),xr=or(3),cr=p(((e,r)=>Object.assign(e,r))),ar=p(((e,r)=>{let t,s,o,p;for(t in e)t in r&&(s=e[t],[o,p]=f(s)?s(r[t],t,r):[s,r[t]],r[X(o)?t:o]=p,t!==o&&delete r[t]);return r})),lr=p(((e,r)=>{for(let t in r)r[t]=e(r[t],+t,r);return r})),ir=p(((e,r)=>{const t=u(r);let s,o;t&&(s=0,o=[]);for(let s in r)e(r[s],s)||(t?o.push(+s):delete r[s]);if(t)for(const e of o)r.splice(e-s++,1);return r})),ur=e=>{let r;for(const t in e)r=e[t],h(r)&&ur(r);return Object.freeze(e)},fr=e=>Object.freeze(e),hr=p(((e,r)=>r.unshift(e))),mr=n(((e,r,t)=>{const s=e[0];return tr(s,e.length<2?r:mr(e.slice(1),r,h(t[s])?t[s]:{}),t)})),dr=p(((e,r)=>ir(((r,t)=>!k(t,e)),r)));exports.F=te,exports.T=re,exports.__=e,exports.add=N,exports.all=ue,exports.allPass=he,exports.always=H,exports.any=fe,exports.anyPass=me,exports.append=V,exports.assoc=le,exports.assocPath=ie,exports.bind=S,exports.both=Be,exports.callFrom=oe,exports.callWith=se,exports.clone=Ae,exports.cloneShallow=e=>Ae(e,!0),exports.complement=pe,exports.compose=A,exports.composeAsync=Me,exports.concat=ve,exports.cond=ae,exports.curry=o,exports.curry2=p,exports.curry3=n,exports.divide=W,exports.echo=Ve,exports.empty=e=>{switch(d(e)){case"String":return"";case"Object":return{};case"Array":return[];default:return x}},exports.eq=b,exports.equals=q,exports.explore=(e,r="log")=>R((t=>console[r](e,t))),exports.filter=_e,exports.find=$,exports.findIndex=K,exports.flat=e=>e.flat(c),exports.flatShallow=e=>e.flat(),exports.flatTo=Z,exports.flip=v,exports.forEach=Ne,exports.forEachAsync=Je,exports.forEachSerial=Ge,exports.freeze=e=>ur(Ae(e)),exports.freezeShallow=e=>fr(Ae(e)),exports.fromPairs=e=>Object.fromEntries(e),exports.genBy=ce,exports.getTmpl=e=>{const r=[],t=[],s=e.length;let o,p,n,x=0,c=0,a=!1,l=P(e),i=!1;for(x=0;x<s;x++)switch(o=e[x],o){case"{":if(!l){a=!0,c=x;break}case"}":if(!l){a=!1,r.push(""),t.push(e.slice(c+1,x));break}default:n=e[x+1],i="\\"===o,a||i&&("{"===n||"}"===n)||(p=r.length-1,p<0&&(r.push(""),p++),r[p]+=o),l=i}return e=>{const s=[],o=r.length-1;for(const p in r)x=+p,s.push(r[x]),x!==o&&s.push(we(t[x].split("."),e));return s.join("")}},exports.gt=_,exports.gte=F,exports.head=P,exports.identity=J,exports.ifElse=j,exports.includes=k,exports.indexOf=L,exports.intersection=xe,exports.isEmpty=e=>{switch(d(e)){case"String":case"Array":return 0==G(e);case"Object":for(const r in e)return!1;return!0;default:return null}},exports.isNil=X,exports.join=Pe,exports.keys=e=>Object.keys(e),exports.last=e=>e[G(e)-1],exports.length=G,exports.lt=C,exports.lte=I,exports.map=De,exports.mapKeys=Ke,exports.memoize=e=>{let r,t=!1;return()=>t?r:(t=!0,r=e())},exports.mergeDeep=Fe,exports.mergeDeepAdd=Ue,exports.mergeDeepX=Ie,exports.mergeShallow=Ce,exports.mirror=Qe,exports.multiply=T,exports.noop=()=>{},exports.not=M,exports.notf=Ye,exports.nth=E,exports.omit=ze,exports.once=e=>{let r,t=!1;return(...s)=>t?r:(t=!0,r=e(...s))},exports.overProp=$e,exports.path=we,exports.pathEq=qe,exports.pathOr=be,exports.pathsEq=je,exports.pick=ke,exports.pickBy=Ee,exports.prepend=Y,exports.prop=de,exports.propEq=ye,exports.propsEq=ge,exports.push=Ze,exports.qappend=rr,exports.qassoc=tr,exports.qassocPath=mr,exports.qempty=e=>{if(u(e))e.splice(0);else for(const r in e)delete e[r];return e},exports.qfilter=ir,exports.qfreeze=ur,exports.qfreezeShallow=fr,exports.qmap=lr,exports.qmapKeys=ar,exports.qmergeDeep=pr,exports.qmergeDeepAdd=xr,exports.qmergeDeepX=nr,exports.qmergeShallow=cr,exports.qomit=dr,exports.qprepend=hr,exports.qreduce=sr,exports.qreverse=e=>e.reverse(),exports.range=ne,exports.reduce=Se,exports.reflect=Re,exports.replace=Te,exports.reverse=e=>A((r=>Se(((t,s,o)=>rr(e[r-o],t)),[],e)),N(-1),G)(e),exports.sizeof=e=>{if("Object"===d(e)){let r=0;for(let t in e)r++;return r}return G(e)},exports.slice=z,exports.some=er,exports.sort=U,exports.split=ee,exports.subtract=B,exports.tail=D,exports.take=g,exports.tap=R,exports.test=Q,exports.toLower=e=>e.toLowerCase(),exports.toPairs=e=>Object.entries(e),exports.toUpper=e=>e.toUpperCase(),exports.trim=e=>e.trim(),exports.type=d,exports.typeIs=y,exports.uncurry=e=>(...r)=>sr(((e,r)=>e?e(r):e),e,r),exports.uniq=e=>sr(((e,r)=>k(r,e)?e:rr(r,e)),[],e),exports.values=e=>Object.values(e),exports.waitAll=e=>Promise.all(e),exports.waitTap=He,exports.weakEq=w,exports.when=O,exports.zip=Le,exports.zipObj=We,exports.zipWith=Xe;
package/dist/bundle.d.ts CHANGED
@@ -1,27 +1,29 @@
1
1
  export { __ }
2
2
 
3
- // Generated by dts-bundle-generator v7.1.0
3
+ // Generated by dts-bundle-generator v9.3.1
4
4
 
5
5
  export type Cond = (x1?: any, x2?: any, x3?: any) => boolean;
6
6
  export interface AnyObject {
7
7
  [k: string]: any;
8
8
  }
9
9
  export type AnyArgs = any[];
10
- export type Curried<Args extends AnyArgs = AnyArgs, ReturnT = any> = (arg: Args[number]) => Curried<Args> | ReturnT;
10
+ export type Reducer<T = any> = (accum: T, cur: any, index: number) => T;
11
11
  export type AnyFunc<ReturnT = any, Args extends AnyArgs = AnyArgs> = (...args: Args) => ReturnT;
12
- export type Placeholder = symbol;
13
- declare const __: Placeholder;
12
+ export type TupleFn<ARG1 = any, ARG2 = any, Out = any> = (a: ARG1, b: ARG2) => Out;
13
+ export type Curried<Args extends AnyArgs = AnyArgs, ReturnT = any> = (arg: Args[number]) => Curried<Args> | ReturnT;
14
+ type Placeholder = symbol;
15
+ export declare const __: Placeholder;
14
16
  export declare const curry: (fn: AnyFunc) => (...args: AnyArgs) => any;
15
- export type Func2 = (a: any, b: any) => any;
17
+ type Func2 = (a: any, b: any) => any;
16
18
  export declare function curry2<Func extends Func2>(fn: Func): {
17
19
  (a: Placeholder, b: Parameters<Func>[1]): (a: Parameters<Func>[0]) => ReturnType<Func>;
18
20
  (a: Parameters<Func>[0], b: Placeholder): (b: Parameters<Func>[1]) => ReturnType<Func>;
19
21
  (a: Parameters<Func>[0]): (b: Parameters<Func>[1]) => ReturnType<Func>;
20
22
  (a: Parameters<Func>[0], b: Parameters<Func>[1]): ReturnType<Func>;
21
23
  };
22
- export type Func3 = (a: any, b: any, c: any) => any;
24
+ type Func3 = (a: any, b: any, c: any) => any;
23
25
  export declare function curry3<Func extends Func3>(fn: Func): (...args: AnyArgs) => any;
24
- export declare const uncurry: <Args extends any[] = any[], ReturnT = any>(fn: Curried<Args, any>) => AnyFunc;
26
+ export declare const uncurry: <Args extends any[] = any[], ReturnT = any>(fn: Curried<Args>) => AnyFunc;
25
27
  export declare const toLower: (s: string) => string;
26
28
  export declare const toUpper: (s: string) => string;
27
29
  export declare const type: (s: any) => any;
@@ -32,6 +34,18 @@ export declare const typeIs: {
32
34
  (a: string, b: any): boolean;
33
35
  };
34
36
  export declare const take: (argN: number) => (...args: any[]) => any;
37
+ export declare const eq: {
38
+ (a: symbol, b: any): (a: any) => boolean;
39
+ (a: any, b: symbol): (b: any) => boolean;
40
+ (a: any): (b: any) => boolean;
41
+ (a: any, b: any): boolean;
42
+ };
43
+ export declare const weakEq: {
44
+ (a: symbol, b: any): (a: any) => boolean;
45
+ (a: any, b: symbol): (b: any) => boolean;
46
+ (a: any): (b: any) => boolean;
47
+ (a: any, b: any): boolean;
48
+ };
35
49
  export declare const equals: {
36
50
  (a: symbol, b: any): (a: any) => boolean;
37
51
  (a: any, b: symbol): (b: any) => boolean;
@@ -40,7 +54,7 @@ export declare const equals: {
40
54
  };
41
55
  export declare const ifElse: (...args: AnyArgs) => any;
42
56
  export declare const when: (...args: AnyArgs) => any;
43
- export type Composed<TIn extends any[], TOut> = (...xs: TIn) => TOut;
57
+ type Composed<TIn extends any[], TOut> = (...xs: TIn) => TOut;
44
58
  export declare const compose: <TIn extends any[] = any[], TOut = any>(...fns: AnyFunc[]) => Composed<TIn, TOut>;
45
59
  export declare const bind: {
46
60
  (a: symbol, b: any): (a: any) => any;
@@ -61,13 +75,13 @@ export declare const includes: {
61
75
  (a: unknown, b: unknown[]): boolean;
62
76
  };
63
77
  export declare const slice: (...args: AnyArgs) => any;
64
- export declare const flip: <T extends AnyFunc<any, AnyArgs>>(fn: T) => {
78
+ export declare const flip: <T extends AnyFunc>(fn: T) => {
65
79
  (a: symbol, b: Parameters<T>[0]): (a: Parameters<T>[1]) => any;
66
80
  (a: Parameters<T>[1], b: symbol): (b: Parameters<T>[0]) => any;
67
81
  (a: Parameters<T>[1]): (b: Parameters<T>[0]) => any;
68
82
  (a: Parameters<T>[1], b: Parameters<T>[0]): any;
69
83
  };
70
- export declare const head: <T = any>(xs: string | T[]) => T;
84
+ export declare const head: <T = any>(xs: T[] | string) => T;
71
85
  export declare const tail: any;
72
86
  export declare const add: {
73
87
  (a: symbol, b: number): (a: number) => number;
@@ -142,13 +156,25 @@ export declare const divide: {
142
156
  (a: number, b: number): number;
143
157
  };
144
158
  export declare const isNil: (s: any) => boolean;
145
- export declare const length: (s: any[] | string) => number;
159
+ declare const length$1: (s: any[] | string) => number;
146
160
  export declare const always: <T = any>(s: T) => () => T;
147
161
  export declare const identity: (s: any) => any;
148
162
  export declare const trim: (s: string) => string;
149
163
  export declare const last: (s: any[] | string) => any;
150
- export declare const not: (o: boolean) => boolean;
151
- export declare const keys: (o: AnyObject | any[]) => string[];
164
+ type NotOverload = {
165
+ (x: true): false;
166
+ (x: false): true;
167
+ (x: any): boolean;
168
+ };
169
+ export declare const not: NotOverload;
170
+ type IndexesOfArray<A> = Exclude<keyof A, keyof [
171
+ ]>;
172
+ type KeysOverload = {
173
+ <T extends any[]>(o: T): string[];
174
+ <T extends readonly any[]>(o: T): IndexesOfArray<T>[];
175
+ <T extends AnyObject>(o: T): (keyof T)[];
176
+ };
177
+ export declare const keys: KeysOverload;
152
178
  export declare const values: (o: AnyObject | any[]) => any[];
153
179
  export declare const toPairs: (o: AnyObject | any[]) => [
154
180
  string,
@@ -172,6 +198,20 @@ export declare const append: {
172
198
  (a: any): (b: any[]) => any[];
173
199
  (a: any, b: any[]): any[];
174
200
  };
201
+ export declare const prepend: {
202
+ (a: symbol, b: any[]): (a: any) => any[];
203
+ (a: any, b: symbol): (b: any[]) => any[];
204
+ (a: any): (b: any[]) => any[];
205
+ (a: any, b: any[]): any[];
206
+ };
207
+ export declare const flat: (xs: any[]) => any[];
208
+ export declare const flatShallow: (xs: any[]) => any[];
209
+ export declare const flatTo: {
210
+ (a: symbol, b: any[]): (a: number) => any[];
211
+ (a: number, b: symbol): (b: any[]) => any[];
212
+ (a: number): (b: any[]) => any[];
213
+ (a: number, b: any[]): any[];
214
+ };
175
215
  export declare const split: {
176
216
  (a: symbol, b: string): (a: string | RegExp) => string[];
177
217
  (a: string | RegExp, b: symbol): (b: string) => string[];
@@ -181,12 +221,17 @@ export declare const split: {
181
221
  export declare const T: (...args: any[]) => true;
182
222
  export declare const F: (...args: any[]) => false;
183
223
  export declare const callWith: {
184
- (a: symbol, b: AnyFunc<any, AnyArgs>): (a: any[]) => any;
185
- (a: any[], b: symbol): (b: AnyFunc<any, AnyArgs>) => any;
186
- (a: any[]): (b: AnyFunc<any, AnyArgs>) => any;
187
- (a: any[], b: AnyFunc<any, AnyArgs>): any;
188
- };
189
- export declare const noop: (..._args: any[]) => void;
224
+ (a: symbol, b: AnyFunc): (a: any[]) => any;
225
+ (a: any[], b: symbol): (b: AnyFunc) => any;
226
+ (a: any[]): (b: AnyFunc) => any;
227
+ (a: any[], b: AnyFunc): any;
228
+ };
229
+ export declare const noop: (...args: any[]) => any;
230
+ /** Calls a func from object.
231
+ * @param {any[]} [args] - arguments for the function.
232
+ * @param {string} [fnName] - property name of the function.
233
+ * @param {AnyObject} [o] - the object with the function. */
234
+ export declare const callFrom: (...args: AnyArgs) => any;
190
235
  export declare const complement: (fn: AnyFunc) => (...args: any) => boolean | any;
191
236
  export declare const sizeof: (s: any[] | string | AnyObject) => number;
192
237
  export declare const range: {
@@ -208,7 +253,7 @@ export declare const genBy: {
208
253
  (a: (i: number) => any): (b: number) => any[];
209
254
  (a: (i: number) => any, b: number): any[];
210
255
  };
211
- export declare const once: <Func extends AnyFunc<any, AnyArgs>>(fn: Func) => (...args: Parameters<Func>) => any;
256
+ export declare const once: <Func extends AnyFunc>(fn: Func) => (...args: Parameters<Func>) => any;
212
257
  export declare const reverse: (xs: any[]) => any;
213
258
  export declare const explore: (caption: string, level?: string) => (b: any) => any;
214
259
  export declare const cond: {
@@ -274,6 +319,8 @@ export declare const pathEq: (...args: AnyArgs) => any;
274
319
  export declare const pathsEq: (...args: AnyArgs) => any;
275
320
  export declare const clone: (s: any, shallow?: boolean) => any;
276
321
  export declare const cloneShallow: (s: any) => any;
322
+ export declare const freeze: <T extends AnyObject>(o: T) => Readonly<T>;
323
+ export declare const freezeShallow: <T extends AnyObject>(o: T) => Readonly<T>;
277
324
  /** types T1, T2
278
325
  * @param reducer (accum: T1, current: T2, index: number) => newAccum: T1
279
326
  * @param accum T1
@@ -367,16 +414,16 @@ export declare const overProp: (...args: AnyArgs) => any;
367
414
  /** mapKeys({ a: 'b' }, { a: 44 }) -> { b: 44 } */
368
415
  export declare const mapKeys: {
369
416
  (a: symbol, b: AnyObject): (a: {
370
- [oldKey: string]: string;
417
+ [oldKey: string]: string | AnyFunc;
371
418
  }) => AnyObject;
372
419
  (a: {
373
- [oldKey: string]: string;
420
+ [oldKey: string]: string | AnyFunc;
374
421
  }, b: symbol): (b: AnyObject) => AnyObject;
375
422
  (a: {
376
- [oldKey: string]: string;
423
+ [oldKey: string]: string | AnyFunc;
377
424
  }): (b: AnyObject) => AnyObject;
378
425
  (a: {
379
- [oldKey: string]: string;
426
+ [oldKey: string]: string | AnyFunc;
380
427
  }, b: AnyObject): AnyObject;
381
428
  };
382
429
  export declare const zip: {
@@ -400,10 +447,10 @@ export declare const zipObj: {
400
447
  export declare const zipWith: (...args: AnyArgs) => any;
401
448
  /** One promise waits for another. */
402
449
  export declare const forEachSerial: {
403
- (a: symbol, b: any[]): (a: AnyFunc<any, AnyArgs>) => Promise<void>;
404
- (a: AnyFunc<any, AnyArgs>, b: symbol): (b: any[]) => Promise<void>;
405
- (a: AnyFunc<any, AnyArgs>): (b: any[]) => Promise<void>;
406
- (a: AnyFunc<any, AnyArgs>, b: any[]): Promise<void>;
450
+ (a: symbol, b: any[]): (a: AnyFunc) => Promise<void>;
451
+ (a: AnyFunc, b: symbol): (b: any[]) => Promise<void>;
452
+ (a: AnyFunc): (b: any[]) => Promise<void>;
453
+ (a: AnyFunc, b: any[]): Promise<void>;
407
454
  };
408
455
  /** Promise.all wrapper for functional pipelining. */
409
456
  export declare const waitAll: (promises: Promise<any>[]) => Promise<any[]>;
@@ -413,10 +460,10 @@ export declare const waitAll: (promises: Promise<any>[]) => Promise<any[]>;
413
460
  * @returns {T}
414
461
  */
415
462
  export declare const waitTap: {
416
- (a: symbol, b: any): (a: AnyFunc<any, AnyArgs>) => Promise<any>;
417
- (a: AnyFunc<any, AnyArgs>, b: symbol): (b: any) => Promise<any>;
418
- (a: AnyFunc<any, AnyArgs>): (b: any) => Promise<any>;
419
- (a: AnyFunc<any, AnyArgs>, b: any): Promise<any>;
463
+ (a: symbol, b: any): (a: AnyFunc) => Promise<any>;
464
+ (a: AnyFunc, b: symbol): (b: any) => Promise<any>;
465
+ (a: AnyFunc): (b: any) => Promise<any>;
466
+ (a: AnyFunc, b: any): Promise<any>;
420
467
  };
421
468
  /** Waits for all promises mapped by the fn. */
422
469
  export declare const forEachAsync: {
@@ -463,16 +510,16 @@ export declare const qmergeShallow: {
463
510
  /** qmapKeys({ a: 'b' }, { a: 44 }) -> { b: 44 } */
464
511
  export declare const qmapKeys: {
465
512
  (a: symbol, b: AnyObject): (a: {
466
- [oldKey: string]: string | AnyFunc<any, AnyArgs>;
513
+ [oldKey: string]: string | AnyFunc;
467
514
  }) => AnyObject;
468
515
  (a: {
469
- [oldKey: string]: string | AnyFunc<any, AnyArgs>;
516
+ [oldKey: string]: string | AnyFunc;
470
517
  }, b: symbol): (b: AnyObject) => AnyObject;
471
518
  (a: {
472
- [oldKey: string]: string | AnyFunc<any, AnyArgs>;
519
+ [oldKey: string]: string | AnyFunc;
473
520
  }): (b: AnyObject) => AnyObject;
474
521
  (a: {
475
- [oldKey: string]: string | AnyFunc<any, AnyArgs>;
522
+ [oldKey: string]: string | AnyFunc;
476
523
  }, b: AnyObject): AnyObject;
477
524
  };
478
525
  export declare const qmap: {
@@ -487,7 +534,28 @@ export declare const qfilter: {
487
534
  (a: (v: any, k: string | number) => boolean): (b: any[] | AnyObject) => any[] | AnyObject;
488
535
  (a: (v: any, k: string | number) => boolean, b: any[] | AnyObject): any[] | AnyObject;
489
536
  };
490
- export type StrTmpl = ((data: AnyObject) => string);
537
+ export declare const qempty: (o: AnyObject | any[]) => any[] | AnyObject;
538
+ export declare const qfreeze: <T extends AnyObject>(o: T) => Readonly<T>;
539
+ export declare const qfreezeShallow: <T extends AnyObject>(o: T) => Readonly<T>;
540
+ export declare const qprepend: {
541
+ (a: symbol, b: any[]): (a: any) => number;
542
+ (a: any, b: symbol): (b: any[]) => number;
543
+ (a: any): (b: any[]) => number;
544
+ (a: any, b: any[]): number;
545
+ };
546
+ export declare const qassocPath: any;
547
+ export declare const qreverse: (arr: any[]) => any[];
548
+ export declare const qomit: {
549
+ (a: symbol, b: AnyObject): (a: string[]) => any[] | AnyObject;
550
+ (a: string[], b: symbol): (b: AnyObject) => any[] | AnyObject;
551
+ (a: string[]): (b: AnyObject) => any[] | AnyObject;
552
+ (a: string[], b: AnyObject): any[] | AnyObject;
553
+ };
554
+ type StrTmpl = ((data: AnyObject) => string);
491
555
  export declare const getTmpl: (tmpl: string) => StrTmpl;
492
556
 
557
+ export {
558
+ length$1 as length,
559
+ };
560
+
493
561
  export {};
package/dist/bundle.mjs CHANGED
@@ -1 +1 @@
1
- const e=Symbol("Placeholder"),r=r=>{let t=0;for(const n of r)n!==e&&t++;return t},t=(r,t)=>{const n=r.length,s=r.slice(),c=t.length;let o=c,u=0;for(;o&&u<n;u++)s[u]===e&&(s[u]=t[c-o],o--);for(u=n;o;u++,o--)s[u]=t[c-o];return s},n=(e,s,c)=>{const o=e.length-s.length-r(c);if(o<1)return e(...t(s,c));{const r=(...r)=>n(e,t(s,c),r);return r.$args_left=o,r}},s=e=>(...t)=>e.length>r(t)?n(e,[],t):e(...t),c=r=>function(t){return t===e?r:r(t)};function o(r){return function(t,n){const s=t===e,o=arguments.length;if(1===o&&s)throw new Error("Senseless placeholder usage.");return arguments.length>1?s?c((e=>r(e,n))):r(t,n):e=>r(t,e)}}function u(e){return s(e)}const a=void 0,i=1/0,l=e=>typeof e,f=e=>null===e,h=e=>"number"==l(e),b=e=>Array.isArray(e),g=e=>"function"===l(e),p={u:"U",b:"B",n:"N",s:"S",f:"F"},y=e=>e.toLowerCase(),j=e=>e.toUpperCase(),d=e=>{const r=l(e);return"object"===r?f(e)?"Null":e.constructor.name:p[r[0]]+r.slice(1)},m=o(((e,r)=>d(r)===e)),w=o(((e,r)=>(r.push(e),r))),O=u(((e,r,t)=>(t[e]=r,t))),A=u(((e,r,t)=>t.reduce(e,r))),S=u(((e,r,t)=>{for(let n in t)switch(d(t[n])){case"Array":if(e>1&&"Array"===d(r[n]))switch(e){case 2:const s=r[n],c=t[n];for(const r in c)s[r]?S(e,s[r],c[r]):s[r]=c[r];break;case 3:r[n].push(...t[n])}else r[n]=t[n];break;case"Object":if("Object"===d(r[n])){S(e,r[n],t[n]);break}default:r[n]=t[n]}return r})),k=S(1),v=S(2),N=S(3),C=o(((e,r)=>Object.assign(e,r))),E=o(((e,r)=>{let t,n,s,c;for(t in e)t in r&&(n=e[t],[s,c]=g(n)?n(r[t],t,r):[n||t,r[t]],r[s]=c,t!==s&&delete r[t]);return r})),P=o(((e,r)=>{for(let t in r)r[t]=e(r[t],+t,r);return r})),$=o(((e,r)=>{const t=b(r);let n,s;t&&(n=0,s=[]);for(let n in r)e(r[n],n)||(t?s.push(+n):delete r[n]);if(t)for(const e of s)r.splice(e-n++,1);return r})),x=e=>(...r)=>A(((e,r)=>e?e(r):e),e,r),B=e=>(...r)=>r[e],U=o(((e,r)=>{const t=d(e);if(t===d(r)&&("Object"===t||"Array"==t)){if(f(e)||f(r))return e===r;if(e===r)return!0;for(const t of[e,r])for(const n in t)if(!(t===r&&n in e||t===e&&n in r&&U(e[n],r[n])))return!1;return!0}return e===r})),_=s(((e,r,t,n)=>e(n)?r(n):t(n))),F=u(((e,r,t)=>_(e,r,ce,t))),I=(...r)=>(...t)=>{let n,s=!0;for(let c=ne(r)-1;c>-1;c--)s?(s=!1,n=r[c](...t)):n=n===e?r[c]():r[c](n);return n},L=o(((e,r)=>e.bind(r))),q=o(((e,r)=>r[e])),z=o(((e,r)=>{if((e=>"string"===l(e))(r))return r.includes(e);for(const t of r)if(U(t,e))return!0;return!1})),D=u(((e,r,t)=>t.slice(e,h(r)?r:i))),G=e=>o(((r,t)=>e(t,r))),H=q(0),J=D(1,i),K=o(((e,r)=>e+r)),M=o(((e,r)=>r-e)),Q=o(((e,r)=>e*r)),R=o(((e,r)=>e>r)),T=o(((e,r)=>e<r)),V=o(((e,r)=>r>=e)),W=o(((e,r)=>r<=e)),X=o(((e,r)=>r.sort(e))),Y=o(((e,r)=>r.find(e))),Z=o(((e,r)=>r.findIndex(e))),ee=o(((e,r)=>Z(U(e),r))),re=o(((e,r)=>e/r)),te=e=>f(e)||(e=>e===a)(e),ne=e=>e.length,se=e=>()=>e,ce=e=>e,oe=e=>e.trim(),ue=e=>e[ne(e)-1],ae=e=>!e,ie=e=>Object.keys(e),le=e=>Object.values(e),fe=e=>Object.entries(e),he=o(((e,r)=>e.test(r))),be=o(((e,r)=>(e(r),r))),ge=o(((e,r)=>[...r,e])),pe=o(((e,r)=>r.split(e))),ye=se(!0),je=se(!1),de=o(((e,r)=>r(...e))),me=(...e)=>{},we=e=>(...r)=>{const t=e(...r),n=g(t);return!n||n&&t.$args_left<=0?ae(t):we(t)},Oe=e=>{if("Object"===d(e)){let r=0;for(let t in e)r++;return r}return ne(e)},Ae=o(((e,r)=>ve(K(e),r-e))),Se=e=>A(((e,r)=>z(r,e)?e:w(r,e)),[],e),ke=o(((e,r)=>e.filter(G(z)(r)))),ve=o(((e,r)=>[...Array(r)].map(((r,t)=>e(t))))),Ne=e=>{let r,t=!1;return(...n)=>t?r:(t=!0,r=e(...n))},Ce=e=>I((r=>Qe(((t,n,s)=>w(e[r-s],t)),[],e)),K(-1),ne)(e),Ee=(e,r="log")=>be((t=>console[r](e,t))),Pe=o(((e,r)=>{for(const[t,n]of e)if(t(r))return n(r)})),$e=u(((e,r,t)=>({...t,[e]:r}))),xe=u(((e,r,t)=>I((n=>{return $e(n,ne(e)<2?r:xe(D(1,i,e),r,(s=t[n],f(s)||"object"!==l(s)?{}:t[n])),t);var s}),H)(e))),Be=o(((e,r)=>r.every(e))),Ue=o(((e,r)=>r.some(e))),_e=o(((e,r)=>e.every((e=>e(r))))),Fe=o(((e,r)=>e.some((e=>e(r))))),Ie=o(((e,r)=>r[e])),Le=u(((e,r,t)=>U(t[e],r))),qe=u(((e,r,t)=>U(r[e],t[e]))),ze=u(((e,r,t)=>_(ne,(()=>te(t)?e:I(_(te,se(e),(t=>ze(e,D(1,i,r),t))),G(Ie)(t),H)(r)),se(t),r))),De=ze(a),Ge=u(((e,r,t)=>U(De(e,t),r))),He=u(((e,r,t)=>U(De(e,r),De(e,t)))),Je=/^(.*?)(8|16|32|64)(Clamped)?Array$/,Ke=(e,r=!1)=>{const t=d(e);switch(t){case"Null":case"String":case"Number":case"Boolean":case"Symbol":return e;case"Array":return r?[...e]:Ze(I(Ke,B(0)),e);case"Object":if(r)return{...e};const n={};for(let r in e)n[r]=Ke(e[r]);return n;default:return Je.test(t)?e.constructor.from(e):e}},Me=e=>Ke(e,!0),Qe=u(((e,r,t)=>A(e,Ke(r),t))),Re=o(((e,r)=>cr(e,r))),Te=o(((e,r)=>{const t={};for(const n of e)n in r&&(t[n]=r[n]);return t})),Ve=o(((e,r)=>cr(((r,t)=>!z(t,e)),r))),We=e=>Object.fromEntries(e),Xe=o(((e,r)=>r.concat(e))),Ye=o(((e,r)=>r.join(e))),Ze=o(((e,r)=>r.map(e))),er=o(((e,r)=>r.forEach(e))),rr=u(((e,r,t)=>r(t)&&e(t))),tr=e=>{switch(d(e)){case"String":case"Array":return 0==ne(e);case"Object":for(const r in e)return!1;return!0;default:return null}},nr=e=>{switch(d(e)){case"String":return"";case"Object":return{};case"Array":return[];default:return a}},sr=u(((e,r,t)=>t.replace(e,r))),cr=o(((e,r)=>b(r)?r.filter(e):$(e,{...r}))),or=e=>{let r,t=!1;return()=>t?r:(t=!0,r=e())},ur=o(((e,r)=>Object.assign({},e,r))),ar=o(((e,r)=>k(Ke(e),Ke(r)))),ir=o(((e,r)=>v(Ke(e),Ke(r)))),lr=o(((e,r)=>N(Ke(e),Ke(r)))),fr=u(((e,r,t)=>$e(e,r(t[e]),t))),hr=o(((e,r)=>E(e,Object.assign({},r)))),br=o(((e,r)=>Ze(((e,t)=>[e,r[t]]),e))),gr=o(((e,r)=>Qe(((e,t,n)=>$e(t,r[n],e)),{},e))),pr=u(((e,r,t)=>Ze(((r,n)=>e(r,t[n])),r))),yr=(()=>{const e=async(r,t,n)=>{n<t.length&&(await r(t[n]),await e(r,t,++n))};return o(((r,t)=>e(r,t,0)))})(),jr=e=>Promise.all(e),dr=o((async(e,r)=>(await e(r),r))),mr=o(((e,r)=>Promise.all(r.map(e)))),wr=(()=>{const e=async(r,t,n)=>~n?await e(r,[await r[n](...t)],--n):H(t);return(...r)=>(...t)=>e(r,t,r.length-1)})(),Or=ce,Ar=ce,Sr=ce,kr=we,vr=ge,Nr=Ue,Cr=e=>{const r=[],t=[],n=e.length;let s,c,o,u=0,a=0,i=!1,l=H(e),f=!1;for(u=0;u<n;u++)switch(s=e[u],s){case"{":if(!l){i=!0,a=u;break}case"}":if(!l){i=!1,r.push(""),t.push(e.slice(a+1,u));break}default:o=e[u+1],f="\\"===s,i||f&&("{"===o||"}"===o)||(c=r.length-1,c<0&&(r.push(""),c++),r[c]+=s),l=f}return e=>{const n=[],s=r.length-1;for(const c in r)u=+c,n.push(r[u]),u!==s&&n.push(De(t[u].split("."),e));return n.join("")}};export{je as F,ye as T,e as __,K as add,Be as all,_e as allPass,se as always,Ue as any,Fe as anyPass,ge as append,$e as assoc,xe as assocPath,L as bind,rr as both,de as callWith,Ke as clone,Me as cloneShallow,we as complement,I as compose,wr as composeAsync,Xe as concat,Pe as cond,s as curry,o as curry2,u as curry3,re as divide,Sr as echo,nr as empty,U as equals,Ee as explore,cr as filter,Y as find,Z as findIndex,G as flip,er as forEach,mr as forEachAsync,yr as forEachSerial,We as fromPairs,ve as genBy,Cr as getTmpl,R as gt,V as gte,H as head,ce as identity,_ as ifElse,z as includes,ee as indexOf,ke as intersection,tr as isEmpty,te as isNil,Ye as join,ie as keys,ue as last,ne as length,T as lt,W as lte,Ze as map,hr as mapKeys,or as memoize,ar as mergeDeep,lr as mergeDeepAdd,ir as mergeDeepX,ur as mergeShallow,Or as mirror,Q as multiply,me as noop,ae as not,kr as notf,q as nth,Ve as omit,Ne as once,fr as overProp,De as path,Ge as pathEq,ze as pathOr,He as pathsEq,Te as pick,Re as pickBy,Ie as prop,Le as propEq,qe as propsEq,vr as push,w as qappend,O as qassoc,$ as qfilter,P as qmap,E as qmapKeys,k as qmergeDeep,N as qmergeDeepAdd,v as qmergeDeepX,C as qmergeShallow,A as qreduce,Ae as range,Qe as reduce,Ar as reflect,sr as replace,Ce as reverse,Oe as sizeof,D as slice,Nr as some,X as sort,pe as split,M as subtract,J as tail,B as take,be as tap,he as test,y as toLower,fe as toPairs,j as toUpper,oe as trim,d as type,m as typeIs,x as uncurry,Se as uniq,le as values,jr as waitAll,dr as waitTap,F as when,br as zip,gr as zipObj,pr as zipWith};
1
+ const e=Symbol("Placeholder"),r=r=>{let t=0;for(const n of r)n!==e&&t++;return t},t=(r,t)=>{const n=r.length,s=r.slice(),c=t.length;let o=c,l=0;for(;o&&l<n;l++)s[l]===e&&(s[l]=t[c-o],o--);for(l=n;o;l++,o--)s[l]=t[c-o];return s},n=(e,s,c)=>{const o=e.length-s.length-r(c);if(o<1)return e(...t(s,c));{const r=(...r)=>n(e,t(s,c),r);return r.$args_left=o,r}},s=e=>(...t)=>e.length>r(t)?n(e,[],t):e(...t);function c(r){return function(t,n){const s=t===e;if(1===arguments.length&&s)throw new Error("Senseless placeholder usage.");return arguments.length>1?s?(r=>function(t){return t===e?r:r(t)})((e=>r(e,n))):r(t,n):e=>r(t,e)}}function o(e){return s(e)}const l=void 0,i=1/0,u=e=>typeof e,a=e=>null===e,f=e=>"number"==u(e),h=e=>Array.isArray(e),b=e=>"function"===u(e),g=e=>!a(e)&&"object"===u(e),p={u:"U",b:"B",n:"N",s:"S",f:"F"},j=e=>e.toLowerCase(),y=e=>e.toUpperCase(),d=e=>{const r=u(e);return"object"===r?a(e)?"Null":e.constructor.name:p[r[0]]+r.slice(1)},m=c(((e,r)=>d(r)===e)),O=e=>(...r)=>r[e],w=c(((e,r)=>e===r)),A=c(((e,r)=>e==r)),S=c(((e,r)=>{const t=d(e);if(w(t,d(r))&&(w(t,"Object")||w(t,"Array"))){if(a(e)||a(r))return w(e,r);if(w(e,r))return!0;for(const t of[e,r])for(const n in t)if(!(w(t,r)&&n in e||w(t,e)&&n in r&&S(e[n],r[n])))return!1;return!0}return w(e,r)})),k=s(((e,r,t,n)=>e(n)?r(n):t(n))),v=o(((e,r,t)=>k(e,r,V,t))),N=(...r)=>(...t)=>{let n,s=!0;for(let c=R(r)-1;c>-1;c--)s?(s=!1,n=r[c](...t)):n=n===e?r[c]():r[c](n);return n},C=c(((e,r)=>e.bind(r))),E=c(((e,r)=>r[e])),P=c(((e,r)=>{if((e=>"string"===u(e))(r))return r.includes(e);for(const t of r)if(S(t,e))return!0;return!1})),$=o(((e,r,t)=>t.slice(e,f(r)?r:i))),x=e=>c(((r,t)=>e(t,r))),z=E(0),B=$(1,i),U=c(((e,r)=>e+r)),_=c(((e,r)=>r-e)),D=c(((e,r)=>e*r)),F=c(((e,r)=>e>r)),I=c(((e,r)=>e<r)),L=c(((e,r)=>r>=e)),q=c(((e,r)=>r<=e)),G=c(((e,r)=>r.sort(e))),H=c(((e,r)=>r.find(e))),J=c(((e,r)=>r.findIndex(e))),K=c(((e,r)=>J(S(e),r))),M=c(((e,r)=>e/r)),Q=e=>a(e)||(e=>e===l)(e),R=e=>e.length,T=e=>()=>e,V=e=>e,W=e=>e.trim(),X=e=>e[R(e)-1],Y=e=>!e,Z=e=>Object.keys(e),ee=e=>Object.values(e),re=e=>Object.entries(e),te=c(((e,r)=>e.test(r))),ne=c(((e,r)=>(e(r),r))),se=c(((e,r)=>[...r,e])),ce=c(((e,r)=>[...r,e])),oe=e=>e.flat(i),le=e=>e.flat(),ie=c(((e,r)=>r.flat(e))),ue=c(((e,r)=>r.split(e))),ae=T(!0),fe=T(!1),he=c(((e,r)=>r(...e))),be=()=>{},ge=s(((e,r,t)=>t[r](...e))),pe=e=>(...r)=>{const t=e(...r),n=b(t);return!n||n&&t.$args_left<=0?Y(t):pe(t)},je=e=>{if("Object"===d(e)){let r=0;for(let t in e)r++;return r}return R(e)},ye=c(((e,r)=>Oe(U(e),r-e))),de=e=>Nr(((e,r)=>P(r,e)?e:kr(r,e)),[],e),me=c(((e,r)=>e.filter(x(P)(r)))),Oe=c(((e,r)=>[...Array(r)].map(((r,t)=>e(t))))),we=e=>{let r,t=!1;return(...n)=>t?r:(t=!0,r=e(...n))},Ae=e=>N((r=>Je(((t,n,s)=>kr(e[r-s],t)),[],e)),U(-1),R)(e),Se=(e,r="log")=>ne((t=>console[r](e,t))),ke=c(((e,r)=>{for(const[t,n]of e)if(t(r))return n(r)})),ve=o(((e,r,t)=>({...t,[e]:r}))),Ne=o(((e,r,t)=>N((n=>ve(n,R(e)<2?r:Ne($(1,i,e),r,g(t[n])?t[n]:{}),t)),z)(e))),Ce=c(((e,r)=>r.every(e))),Ee=c(((e,r)=>r.some(e))),Pe=c(((e,r)=>e.every((e=>e(r))))),$e=c(((e,r)=>e.some((e=>e(r))))),xe=c(((e,r)=>r[e])),ze=o(((e,r,t)=>S(t[e],r))),Be=o(((e,r,t)=>S(r[e],t[e]))),Ue=o(((e,r,t)=>k(R,(()=>Q(t)?e:N(k(Q,T(e),(t=>Ue(e,$(1,i,r),t))),x(xe)(t),z)(r)),T(t),r))),_e=Ue(l),De=o(((e,r,t)=>S(_e(e,t),r))),Fe=o(((e,r,t)=>S(_e(e,r),_e(e,t)))),Ie=/^(.*?)(8|16|32|64)(Clamped)?Array$/,Le=(e,r=!1)=>{const t=d(e);switch(t){case"Null":case"String":case"Number":case"Boolean":case"Symbol":return e;case"Array":return r?[...e]:We(N(Le,O(0)),e);case"Object":if(r)return{...e};const n={};for(let r in e)n[r]=Le(e[r]);return n;default:return Ie.test(t)?e.constructor.from(e):e}},qe=e=>Le(e,!0),Ge=e=>Dr(Le(e)),He=e=>Fr(Le(e)),Je=o(((e,r,t)=>Nr(e,Le(r),t))),Ke=c(((e,r)=>tr(e,r))),Me=c(((e,r)=>{const t={};for(const n of e)n in r&&(t[n]=r[n]);return t})),Qe=c(((e,r)=>tr(((r,t)=>!P(t,e)),r))),Re=e=>Object.fromEntries(e),Te=c(((e,r)=>r.concat(e))),Ve=c(((e,r)=>r.join(e))),We=c(((e,r)=>r.map(e))),Xe=c(((e,r)=>r.forEach(e))),Ye=o(((e,r,t)=>r(t)&&e(t))),Ze=e=>{switch(d(e)){case"String":case"Array":return 0==R(e);case"Object":for(const r in e)return!1;return!0;default:return null}},er=e=>{switch(d(e)){case"String":return"";case"Object":return{};case"Array":return[];default:return l}},rr=o(((e,r,t)=>t.replace(e,r))),tr=c(((e,r)=>h(r)?r.filter(e):Ur(e,{...r}))),nr=e=>{let r,t=!1;return()=>t?r:(t=!0,r=e())},sr=c(((e,r)=>Object.assign({},e,r))),cr=c(((e,r)=>Er(Le(e),Le(r)))),or=c(((e,r)=>Pr(Le(e),Le(r)))),lr=c(((e,r)=>$r(Le(e),Le(r)))),ir=o(((e,r,t)=>ve(e,r(t[e]),t))),ur=c(((e,r)=>zr(e,Object.assign({},r)))),ar=c(((e,r)=>We(((e,t)=>[e,r[t]]),e))),fr=c(((e,r)=>Je(((e,t,n)=>ve(t,r[n],e)),{},e))),hr=o(((e,r,t)=>We(((r,n)=>e(r,t[n])),r))),br=(()=>{const e=async(r,t,n)=>{n<t.length&&(await r(t[n]),await e(r,t,++n))};return c(((r,t)=>e(r,t,0)))})(),gr=e=>Promise.all(e),pr=c((async(e,r)=>(await e(r),r))),jr=c(((e,r)=>Promise.all(r.map(e)))),yr=(()=>{const e=async(r,t,n)=>~n?await e(r,[await r[n](...t)],--n):z(t);return(...r)=>(...t)=>e(r,t,r.length-1)})(),dr=V,mr=V,Or=V,wr=pe,Ar=se,Sr=Ee,kr=c(((e,r)=>(r.push(e),r))),vr=o(((e,r,t)=>(t[e]=r,t))),Nr=o(((e,r,t)=>t.reduce(e,r))),Cr=o(((e,r,t)=>{for(let n in t)switch(d(t[n])){case"Array":if(e>1&&"Array"===d(r[n]))switch(e){case 2:const s=r[n],c=t[n];for(const r in c)s[r]?Cr(e,s[r],c[r]):s[r]=c[r];break;case 3:r[n].push(...t[n])}else r[n]=t[n];break;case"Object":if("Object"===d(r[n])){Cr(e,r[n],t[n]);break}default:r[n]=t[n]}return r})),Er=Cr(1),Pr=Cr(2),$r=Cr(3),xr=c(((e,r)=>Object.assign(e,r))),zr=c(((e,r)=>{let t,n,s,c;for(t in e)t in r&&(n=e[t],[s,c]=b(n)?n(r[t],t,r):[n,r[t]],r[Q(s)?t:s]=c,t!==s&&delete r[t]);return r})),Br=c(((e,r)=>{for(let t in r)r[t]=e(r[t],+t,r);return r})),Ur=c(((e,r)=>{const t=h(r);let n,s;t&&(n=0,s=[]);for(let n in r)e(r[n],n)||(t?s.push(+n):delete r[n]);if(t)for(const e of s)r.splice(e-n++,1);return r})),_r=e=>{if(h(e))e.splice(0);else for(const r in e)delete e[r];return e},Dr=e=>{let r;for(const t in e)r=e[t],g(r)&&Dr(r);return Object.freeze(e)},Fr=e=>Object.freeze(e),Ir=c(((e,r)=>r.unshift(e))),Lr=o(((e,r,t)=>{const n=e[0];return vr(n,e.length<2?r:Lr(e.slice(1),r,g(t[n])?t[n]:{}),t)})),qr=e=>e.reverse(),Gr=c(((e,r)=>Ur(((r,t)=>!P(t,e)),r))),Hr=e=>(...r)=>Nr(((e,r)=>e?e(r):e),e,r),Jr=e=>{const r=[],t=[],n=e.length;let s,c,o,l=0,i=0,u=!1,a=z(e),f=!1;for(l=0;l<n;l++)switch(s=e[l],s){case"{":if(!a){u=!0,i=l;break}case"}":if(!a){u=!1,r.push(""),t.push(e.slice(i+1,l));break}default:o=e[l+1],f="\\"===s,u||f&&("{"===o||"}"===o)||(c=r.length-1,c<0&&(r.push(""),c++),r[c]+=s),a=f}return e=>{const n=[],s=r.length-1;for(const c in r)l=+c,n.push(r[l]),l!==s&&n.push(_e(t[l].split("."),e));return n.join("")}};export{fe as F,ae as T,e as __,U as add,Ce as all,Pe as allPass,T as always,Ee as any,$e as anyPass,se as append,ve as assoc,Ne as assocPath,C as bind,Ye as both,ge as callFrom,he as callWith,Le as clone,qe as cloneShallow,pe as complement,N as compose,yr as composeAsync,Te as concat,ke as cond,s as curry,c as curry2,o as curry3,M as divide,Or as echo,er as empty,w as eq,S as equals,Se as explore,tr as filter,H as find,J as findIndex,oe as flat,le as flatShallow,ie as flatTo,x as flip,Xe as forEach,jr as forEachAsync,br as forEachSerial,Ge as freeze,He as freezeShallow,Re as fromPairs,Oe as genBy,Jr as getTmpl,F as gt,L as gte,z as head,V as identity,k as ifElse,P as includes,K as indexOf,me as intersection,Ze as isEmpty,Q as isNil,Ve as join,Z as keys,X as last,R as length,I as lt,q as lte,We as map,ur as mapKeys,nr as memoize,cr as mergeDeep,lr as mergeDeepAdd,or as mergeDeepX,sr as mergeShallow,dr as mirror,D as multiply,be as noop,Y as not,wr as notf,E as nth,Qe as omit,we as once,ir as overProp,_e as path,De as pathEq,Ue as pathOr,Fe as pathsEq,Me as pick,Ke as pickBy,ce as prepend,xe as prop,ze as propEq,Be as propsEq,Ar as push,kr as qappend,vr as qassoc,Lr as qassocPath,_r as qempty,Ur as qfilter,Dr as qfreeze,Fr as qfreezeShallow,Br as qmap,zr as qmapKeys,Er as qmergeDeep,$r as qmergeDeepAdd,Pr as qmergeDeepX,xr as qmergeShallow,Gr as qomit,Ir as qprepend,Nr as qreduce,qr as qreverse,ye as range,Je as reduce,mr as reflect,rr as replace,Ae as reverse,je as sizeof,$ as slice,Sr as some,G as sort,ue as split,_ as subtract,B as tail,O as take,ne as tap,te as test,j as toLower,re as toPairs,y as toUpper,W as trim,d as type,m as typeIs,Hr as uncurry,de as uniq,ee as values,gr as waitAll,pr as waitTap,A as weakEq,v as when,ar as zip,fr as zipObj,hr as zipWith};
package/package.json CHANGED
@@ -1,80 +1,80 @@
1
- {
2
- "author": {
3
- "name": "Michael houd1ni Akiliev"
4
- },
5
- "bugs": {
6
- "url": "https://github.com/houd1ni/pepka/issues"
7
- },
8
- "deprecated": false,
9
- "description": "An ultra lightweight, async or unsafe-speedy ramda alternative.",
10
- "homepage": "https://houd1ni.github.io/pepka/",
11
- "keywords": [
12
- "ramda",
13
- "functional",
14
- "fp",
15
- "pure",
16
- "strongly-typed",
17
- "typescript",
18
- "d.ts"
19
- ],
20
- "license": "MIT",
21
- "type": "module",
22
- "exports": {
23
- ".": {
24
- "import": "./dist/bundle.mjs",
25
- "require": "./dist/bundle.cjs"
26
- }
27
- },
28
- "name": "pepka",
29
- "repository": {
30
- "type": "git",
31
- "url": "git+https://github.com/houd1ni/pepka.git"
32
- },
33
- "scripts": {
34
- "lint": "tslint src/*.ts",
35
- "test": "npm run gentypes && npm run prod:es && ava",
36
- "test:report": "nyc npm test && nyc report --reporter=text-lcov > coverage.lcov && codecov",
37
- "test:lazy": "ava",
38
- "dts-fix": "node dts-fix.js",
39
- "gentypes": "dts-bundle-generator --no-check -o dist/bundle.d.ts src/index.ts && npm run dts-fix",
40
- "dev": "cross-env NODE_ENV=development BUILD=es rollup -c",
41
- "prod:cjs": "cross-env NODE_ENV=production BUILD=cjs rollup -c",
42
- "prod:es": "cross-env NODE_ENV=production BUILD=es rollup -c",
43
- "prod": "npm run gentypes && npm run prod:es && npm run prod:cjs",
44
- "all": "npm run dev && npm run prod"
45
- },
46
- "version": "1.0.0-beta.8",
47
- "ava": {
48
- "files": [
49
- "./test/specs/*.ts"
50
- ],
51
- "failFast": true,
52
- "timeout": "2m",
53
- "extensions": [
54
- "ts"
55
- ],
56
- "require": [
57
- "ts-node/register"
58
- ]
59
- },
60
- "devDependencies": {
61
- "@rollup/plugin-commonjs": "^23.0.3",
62
- "@rollup/plugin-node-resolve": "^15.0.1",
63
- "@rollup/plugin-replace": "^5.0.1",
64
- "@rollup/plugin-terser": "^0.1.0",
65
- "@types/node": "^18.11.11",
66
- "ava": "^5.1.0",
67
- "codecov": "^3.8.2",
68
- "cross-env": "^7.0.3",
69
- "dts-bundle-generator": "^7.1.0",
70
- "nyc": "^15.1.0",
71
- "prepend": "^1.0.2",
72
- "rollup": "^3.6.0",
73
- "rollup-plugin-typescript2": "^0.34.1",
74
- "ts-node": "^10.9.1",
75
- "tslint": "^6.1.0",
76
- "typescript": "^4.9.4"
77
- },
78
- "types": "./dist/bundle.d.ts",
79
- "sideEffects": false
80
- }
1
+ {
2
+ "author": {
3
+ "name": "Michael houd1ni Akiliev"
4
+ },
5
+ "bugs": {
6
+ "url": "https://github.com/houd1ni/pepka/issues"
7
+ },
8
+ "deprecated": false,
9
+ "description": "An ultra lightweight, async or unsafe-speedy ramda alternative.",
10
+ "homepage": "https://houd1ni.github.io/pepka/",
11
+ "keywords": [
12
+ "ramda",
13
+ "functional",
14
+ "fp",
15
+ "pure",
16
+ "strongly-typed",
17
+ "typescript",
18
+ "d.ts"
19
+ ],
20
+ "license": "MIT",
21
+ "type": "module",
22
+ "exports": {
23
+ ".": {
24
+ "import": "./dist/bundle.mjs",
25
+ "require": "./dist/bundle.cjs"
26
+ }
27
+ },
28
+ "name": "pepka",
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "git+https://github.com/houd1ni/pepka.git"
32
+ },
33
+ "scripts": {
34
+ "lint": "tslint src/*.ts",
35
+ "test": "npm run gentypes && npm run prod:es && ava",
36
+ "test:report": "nyc npm test && nyc report --reporter=text-lcov > coverage.lcov && codecov",
37
+ "test:lazy": "ava",
38
+ "dts-fix": "node dts-fix.js",
39
+ "gentypes": "dts-bundle-generator --no-check --export-referenced-types=false -o dist/bundle.d.ts src/index.ts && npm run dts-fix",
40
+ "dev": "cross-env NODE_ENV=development BUILD=es rollup -c",
41
+ "prod:cjs": "cross-env NODE_ENV=production BUILD=cjs rollup -c",
42
+ "prod:es": "cross-env NODE_ENV=production BUILD=es rollup -c",
43
+ "prod": "npm run gentypes && npm run prod:es && npm run prod:cjs",
44
+ "all": "npm run dev && npm run prod"
45
+ },
46
+ "version": "1.0.0",
47
+ "ava": {
48
+ "files": [
49
+ "./test/specs/*.ts"
50
+ ],
51
+ "failFast": true,
52
+ "timeout": "2m",
53
+ "extensions": [
54
+ "ts"
55
+ ],
56
+ "require": [
57
+ "ts-node/register"
58
+ ]
59
+ },
60
+ "devDependencies": {
61
+ "@rollup/plugin-commonjs": "^25.0.7",
62
+ "@rollup/plugin-node-resolve": "^15.2.3",
63
+ "@rollup/plugin-replace": "^5.0.5",
64
+ "@rollup/plugin-terser": "^0.4.4",
65
+ "@types/node": "^20.12.2",
66
+ "ava": "^6.1.2",
67
+ "codecov": "^3.8.3",
68
+ "cross-env": "^7.0.3",
69
+ "dts-bundle-generator": "^9.3.1",
70
+ "nyc": "^15.1.0",
71
+ "prepend": "^1.0.2",
72
+ "rollup": "^4.13.2",
73
+ "rollup-plugin-typescript2": "^0.36.0",
74
+ "ts-node": "^10.9.2",
75
+ "tslint": "^6.1.3",
76
+ "typescript": "^5.4.3"
77
+ },
78
+ "types": "./dist/bundle.d.ts",
79
+ "sideEffects": false
80
+ }
package/src/curry.ts CHANGED
@@ -43,7 +43,6 @@ const _curry = (fn: Function, args: AnyArgs, new_args: AnyArgs) => {
43
43
  return curried
44
44
  }
45
45
  }
46
-
47
46
  export const curry = (fn: AnyFunc) => (
48
47
  (...args: AnyArgs) => fn.length>countArgs(args)
49
48
  ? _curry(fn, [], args)
package/src/index.ts CHANGED
@@ -4,4 +4,5 @@ export * from './uncurry'
4
4
  export * from './common'
5
5
  export * from './safe'
6
6
  export * from './quick'
7
- export * from './strings'
7
+ export * from './strings'
8
+ export * from './types'
package/src/quick.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { curry2, curry3 } from "./curry"
2
2
  import { type } from "./common"
3
3
  import { AnyObject, Reducer, AnyFunc } from "./types"
4
- import { isFunc, isArray } from "./utils"
5
-
4
+ import { isFunc, isArray, isObj } from "./utils"
5
+ import { includes, isNil } from "./safe"
6
6
  // TODO: qoverProp, qover array ?
7
7
 
8
8
  export const qappend = curry2((s: any, xs: any[]) => {xs.push(s); return xs})
@@ -60,8 +60,8 @@ export const qmapKeys = curry2(
60
60
  mapped = keyMap[k]
61
61
  ;[newKey, newValue] = isFunc(mapped)
62
62
  ? (mapped as AnyFunc)(o[k], k, o)
63
- : [mapped || k, o[k]]
64
- o[newKey] = newValue
63
+ : [mapped, o[k]]
64
+ o[isNil(newKey) ? k : newKey] = newValue
65
65
  if(k !== newKey) delete o[k]
66
66
  }
67
67
  return o
@@ -74,10 +74,10 @@ export const qmap = curry2(
74
74
  }
75
75
  )
76
76
  export const qfilter = curry2(
77
- (
77
+ <T extends any[] | AnyObject>(
78
78
  cond: (v: any, k: string | number) => boolean,
79
- data: any[] | AnyObject
80
- ) => {
79
+ data: T
80
+ ): T => {
81
81
  const isArr = isArray(data)
82
82
  let indicies_offset: number, indicies2rm: number[]
83
83
  if(isArr) {
@@ -87,11 +87,40 @@ export const qfilter = curry2(
87
87
  for(let k in data)
88
88
  if(!cond(data[k], k)) // @ts-ignore
89
89
  if(isArr) indicies2rm.push(+k)
90
- else
91
- delete data[k]
90
+ else delete data[k]
92
91
  if(isArr)// @ts-ignore
93
92
  for(const i of indicies2rm) // @ts-ignore
94
93
  data.splice(i - indicies_offset++, 1)
95
94
  return data
96
95
  }
96
+ )
97
+ export const qempty = (o: AnyObject|any[]) => {
98
+ if(isArray(o)) o.splice(0)
99
+ else for(const i in o) delete o[i]
100
+ return o
101
+ }
102
+ export const qfreeze = <T extends AnyObject>(o: T): Readonly<T> => {
103
+ let v: any
104
+ for(const k in o) {
105
+ v = o[k]
106
+ if(isObj(v)) qfreeze(v)
107
+ }
108
+ return Object.freeze(o)
109
+ }
110
+ export const qfreezeShallow = <T extends AnyObject>(o: T): Readonly<T> => Object.freeze(o)
111
+ export const qprepend = curry2((x: any, xs: any[]) => xs.unshift(x))
112
+ export const qassocPath = curry3((_path: string[], v: any, o: AnyObject) => {
113
+ const first = _path[0]
114
+ return qassoc(first, _path.length<2
115
+ ? v
116
+ : qassocPath(_path.slice(1), v, isObj(o[first]) ? o[first] : {}),
117
+ o
118
+ )
119
+ })
120
+ export const qreverse = (arr: any[]) => arr.reverse()
121
+ export const qomit = curry2(
122
+ (props: string[], o: AnyObject) => qfilter(
123
+ (_: any, k: string) => !includes(k, props),
124
+ o
125
+ )
97
126
  )
package/src/safe.ts CHANGED
@@ -1,25 +1,27 @@
1
1
  import { __, curry, curry2, curry3 } from './curry'
2
2
  import { isNum, isUndef, undef, isNull, isArray, isFunc, isStr, isObj, inf } from './utils'
3
- import { qmergeDeep, qreduce, qappend, qmapKeys, qmergeDeepX, qmergeDeepAdd, qfilter } from './quick'
3
+ import { qmergeDeep, qreduce, qappend, qmapKeys, qmergeDeepX, qmergeDeepAdd, qfilter, qfreeze, qfreezeShallow } from './quick'
4
4
  import { AnyFunc, Cond, AnyObject, Reducer } from './types'
5
5
  import { type } from './common'
6
6
  // over, lensProp
7
7
 
8
8
  export const take = (argN: number) => (...args: any[]) => args[argN]
9
+ export const eq = curry2((a: any, b: any) => a===b)
10
+ export const weakEq = curry2((a: any, b: any) => a==b)
9
11
  export const equals = curry2((a: any, b: any) => {
10
12
  const typea = type(a)
11
- if(typea===type(b) && (typea==='Object' || typea=='Array')) {
12
- if(isNull(a) || isNull(b)) return a===b
13
- if(a===b) return true
13
+ if(eq(typea, type(b)) && (eq(typea, 'Object') || eq(typea, 'Array'))) {
14
+ if(isNull(a) || isNull(b)) return eq(a, b)
15
+ if(eq(a, b)) return true
14
16
  for(const v of [a, b])
15
17
  for(const k in v)
16
18
  if(
17
- !((v===b) && (k in a)) &&
18
- !((v===a) && (k in b) && equals(a[k], b[k]))
19
+ !((eq(v, b)) && (k in a)) &&
20
+ !((eq(v, a)) && (k in b) && equals(a[k], b[k]))
19
21
  ) return false
20
22
  return true
21
23
  }
22
- return a===b
24
+ return eq(a, b)
23
25
  })
24
26
  export const ifElse = curry(
25
27
  (
@@ -92,18 +94,39 @@ export const always = <T=any>(s: T) => () => s
92
94
  export const identity = (s: any) => s
93
95
  export const trim = (s: string) => s.trim()
94
96
  export const last = (s: any[] | string) => s[length(s)-1]
95
- export const not = (o: boolean) => !o
96
- export const keys = (o: AnyObject | any[]) => Object.keys(o)
97
+ type NotOverload = {
98
+ (x: true): false
99
+ (x: false): true
100
+ (x: any): boolean
101
+ }
102
+ export const not: NotOverload = (x: any) => !x as any
103
+ type IndexesOfArray<A> = Exclude<keyof A, keyof []>
104
+ type KeysOverload = {
105
+ <T extends any[]>(o: T): string[]
106
+ <T extends readonly any[]>(o: T): IndexesOfArray<T>[]
107
+ <T extends AnyObject>(o: T): (keyof T)[]
108
+ }
109
+ export const keys: KeysOverload = (o: number[]) => Object.keys(o)
110
+
97
111
  export const values = (o: AnyObject | any[]) => Object.values(o)
98
112
  export const toPairs = (o: AnyObject | any[]) => Object.entries(o)
99
113
  export const test = curry2((re: RegExp, s: string) => re.test(s))
100
- export const tap = curry2((fn: Function, s: any) => { fn(s); return s })
101
- export const append = curry2((s: any, xs: any[]) => [...xs, s])
114
+ export const tap = curry2((fn: Function, x: any) => { fn(x); return x })
115
+ export const append = curry2((x: any, xs: any[]) => [...xs, x])
116
+ export const prepend = curry2((x: any, xs: any[]) => [...xs, x])
117
+ export const flat = (xs: any[]) => xs.flat(inf)
118
+ export const flatShallow = (xs: any[]) => xs.flat()
119
+ export const flatTo = curry2((depth: number, xs: any[]) => xs.flat(depth))
102
120
  export const split = curry2((s: string|RegExp, xs: string) => xs.split(s))
103
121
  export const T = always<true>(true) as (...args: any[]) => true
104
122
  export const F = always<false>(false) as (...args: any[]) => false
105
123
  export const callWith = curry2((args: any[], fn: AnyFunc) => fn(...args))
106
- export const noop = (..._args: any[]) => {}
124
+ export const noop = (()=>{}) as (...args: any[]) => any
125
+ /** Calls a func from object.
126
+ * @param {any[]} [args] - arguments for the function.
127
+ * @param {string} [fnName] - property name of the function.
128
+ * @param {AnyObject} [o] - the object with the function. */
129
+ export const callFrom = curry((args: any[], fn: string, o: AnyObject) => o[fn](...args))
107
130
  export const complement = (fn: AnyFunc) => (...args: any) => {
108
131
  const out = fn(...args)
109
132
  const f = isFunc(out)
@@ -119,6 +142,7 @@ export const sizeof = (s: any[] | string | AnyObject) => {
119
142
  export const range = curry2((from: number, to: number) =>
120
143
  genBy(add(from), to-from)
121
144
  )
145
+ // TODO: make it using equals for deep stuff !
122
146
  export const uniq = (xs: any[]) => qreduce(
123
147
  <T>(accum: any, x: T) =>
124
148
  includes(x, accum) ? accum : qappend(x, accum),
@@ -135,12 +159,9 @@ export const genBy = curry2(
135
159
  export const once = <Func extends AnyFunc>(fn: Func) => {
136
160
  let done = false, cache: any
137
161
  return (...args: Parameters<Func>) => {
138
- if(done) {
139
- return cache
140
- } else {
141
- done = true
142
- return cache = fn(...args)
143
- }
162
+ if(done) return cache
163
+ done = true
164
+ return cache = fn(...args)
144
165
  }
145
166
  }
146
167
  export const reverse = (xs: any[]) => compose(
@@ -244,6 +265,8 @@ export const clone = (s: any, shallow = false) => {
244
265
  }
245
266
  }
246
267
  export const cloneShallow = (s: any) => clone(s, true)
268
+ export const freeze = <T extends AnyObject>(o: T): Readonly<T> => qfreeze(clone(o))
269
+ export const freezeShallow = <T extends AnyObject>(o: T): Readonly<T> => qfreezeShallow(clone(o))
247
270
 
248
271
  /** types T1, T2
249
272
  * @param reducer (accum: T1, current: T2, index: number) => newAccum: T1
@@ -314,7 +337,7 @@ export const replace = curry3(
314
337
  // @ts-ignore Some bug with overload.
315
338
  ) => where.replace(a, b)
316
339
  )
317
- // TODO: it thinks cond is a symbol in usage !!!
340
+ // FIXME: it thinks cond is a symbol in usage !!!
318
341
  export const filter = curry2(
319
342
  (
320
343
  cond: (v: any, k: string | number) => boolean,
@@ -348,7 +371,7 @@ export const overProp = curry3(
348
371
  /** mapKeys({ a: 'b' }, { a: 44 }) -> { b: 44 } */
349
372
  export const mapKeys = curry2(
350
373
  (
351
- keyMap: {[oldKey: string]: string},
374
+ keyMap: {[oldKey: string]: string | AnyFunc},
352
375
  o: AnyObject
353
376
  ) => qmapKeys(keyMap, Object.assign({}, o))
354
377
  )
package/src/timers.ts ADDED
@@ -0,0 +1,18 @@
1
+ import { AnyFunc } from "./types"
2
+
3
+ export const debounce = <T extends AnyFunc>(time: number, fn: T) => {
4
+ let queue: AnyFunc[] = []
5
+ let to: NodeJS.Timeout
6
+ return ((...args: Parameters<T>) => new Promise<ReturnType<T>>((ff) => {
7
+ const qel = async () => {
8
+ clearTimeout(to)
9
+ to = setTimeout(async () => {
10
+ const res = await fn!(...args)
11
+ if(queue.includes(qel)) ff(res)
12
+ }, time)
13
+ }
14
+ queue.splice(0)
15
+ queue.push(qel)
16
+ qel()
17
+ }))
18
+ }
package/src/types.ts CHANGED
@@ -1,15 +1,10 @@
1
1
  export type Cond = (x1?: any, x2?: any, x3?: any) => boolean
2
- export interface AnyObject {
3
- [k: string]: any
4
- }
2
+ export interface AnyObject { [k: string]: any }
5
3
  export type AnyArgs = any[]
4
+ export type Reducer<T=any> = (accum: T, cur: any, index: number) => T
5
+ export type AnyFunc<ReturnT = any, Args extends AnyArgs = AnyArgs> = (...args: Args) => ReturnT
6
+ export type TupleFn<ARG1=any, ARG2=any, Out=any> = (a: ARG1, b: ARG2) => Out
6
7
  export type Curried<
7
8
  Args extends AnyArgs = AnyArgs,
8
9
  ReturnT = any
9
- > = (arg: Args[number]) => Curried<Args> | ReturnT
10
- export type Reducer<T=any> = (accum: T, cur: any, index: number) => T
11
- export type AnyFunc<
12
- ReturnT = any,
13
- Args extends AnyArgs = AnyArgs
14
- > = (...args: Args) => ReturnT
15
- export type TupleFn<ARG1=any, ARG2=any, Out=any> = (a: ARG1, b: ARG2) => Out
10
+ > = (arg: Args[number]) => Curried<Args> | ReturnT