fp-pack 0.11.0 → 0.12.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/README.md +1 -0
- package/dist/ai-addons/fp-pack-agent-addon.md +1 -1
- package/dist/fp-pack.umd.js +1 -1
- package/dist/fp-pack.umd.js.map +1 -1
- package/dist/implement/composition/index.d.ts +1 -0
- package/dist/implement/composition/index.d.ts.map +1 -1
- package/dist/implement/composition/pipeWithDeps.d.ts +65 -0
- package/dist/implement/composition/pipeWithDeps.d.ts.map +1 -0
- package/dist/implement/composition/pipeWithDeps.mjs +20 -0
- package/dist/implement/composition/pipeWithDeps.mjs.map +1 -0
- package/dist/implement/composition/pipeWithDeps.type-test.d.ts +40 -0
- package/dist/implement/composition/pipeWithDeps.type-test.d.ts.map +1 -0
- package/dist/index.mjs +254 -252
- package/dist/index.mjs.map +1 -1
- package/dist/skills/fp-pack/SKILL.md +1 -1
- package/dist/skills/fp-pack.md +1 -1
- package/package.json +1 -1
- package/src/implement/composition/index.ts +1 -0
- package/src/implement/composition/pipeWithDeps.test.ts +75 -0
- package/src/implement/composition/pipeWithDeps.ts +216 -0
- package/src/implement/composition/pipeWithDeps.type-test.ts +77 -0
package/README.md
CHANGED
|
@@ -340,6 +340,7 @@ export default curriedChunk;
|
|
|
340
340
|
Functions for composing and transforming other functions.
|
|
341
341
|
|
|
342
342
|
- **pipe** - Compose functions left to right (f → g → h)
|
|
343
|
+
- **pipeWithDeps** - Bind dependencies once and inject them into pipeline steps
|
|
343
344
|
- **pipeSideEffect** - Compose functions left to right with SideEffect short-circuiting
|
|
344
345
|
- **pipeSideEffectStrict** - SideEffect composition with strict effect unions
|
|
345
346
|
- **compose** - Compose functions right to left (h → g → f)
|
package/dist/fp-pack.umd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(i,m){typeof exports=="object"&&typeof module<"u"?m(exports):typeof define=="function"&&define.amd?define(["exports"],m):(i=typeof globalThis<"u"?globalThis:i||self,m(i.FpPack={}))})(this,(function(i){"use strict";function m(...n){if(n.length===0)return;const[t,...e]=n;if(typeof t=="function"){const r=[t,...e];return u=>r.reduce((c,f)=>f(c),u)}return e.reduce((r,u)=>u(r),t)}function P(n){return n}class d{effect;label;constructor(t,e){this.effect=t,this.label=e}static of(t,e){return new d(t,e)}}function T(n,t){return n instanceof d?t.effect(n):t.value(n)}function M(n){return h(n)?n.effect():n}function h(n){return n instanceof d}function N(...n){const t=(u,c)=>{let f=u;for(const s of c){if(h(f))return f;f=s(f)}return f};if(n.length===0)return;const[e,...r]=n;if(typeof e=="function"){const u=[e,...r];return c=>t(c,u)}return t(e,r)}function k(...n){const t=(u,c)=>{let f=u;for(const s of c){if(h(f))return f;f=s(f)}return f};if(n.length===0)return;const[e,...r]=n;if(typeof e=="function"){const u=[e,...r];return c=>t(c,u)}return t(e,r)}function v(...n){return t=>n.reduceRight((e,r)=>r(e),t)}function o(n,...t){const e=r=>r.length>=n.length?n(...r):(...u)=>e([...r,...u]);return t.length===0?e([]):e(t)}function z(n,...t){return function(...r){const u=[...t,...r];return n.apply(this,u)}}function I(n){return function(...e){const r=[...e].reverse();return n.apply(this,r)}}function W(n,...t){return t.length===0?(...e)=>!n(...e):!n(...t)}function _(n){return n}function D(n){return()=>n}function L(n){const t=e=>n;return Object.defineProperty(t,"__from",{value:!0}),t}function C(n){return t=>(n(t),t)}function K(n){return()=>{n()}}function q(n){let t=!1,e;return function(...u){return t||(t=!0,e=n.apply(this,u)),e}}function B(n){const t=new Map,e=Symbol("result");return function(...u){let c=t;for(const s of u)c.has(s)||c.set(s,new Map),c=c.get(s);if(c.has(e))return c.get(e);const f=n.apply(this,u);return c.set(e,f),f}}function F(n,t,e,r){return n(r)?t(r):e(r)}const V=o(F);function R(n,t,e){return n(e)?t(e):e}const $=o(R);function U(n,t,e){return n(e)?e:t(e)}const j=o(U);function H(n){return t=>{for(const[e,r]of n)if(e(t))return r(t)}}function G(n,t,e){try{return n(e)}catch(r){const u=r instanceof Error?r:new Error(String(r));return t(u,e)}}const Z=o(G);function J(n,t,e){return n(e)?e:t}const Q=o(J);function X(n,t){return t.map(n)}const Y=o(X);function x(n,t){return t.filter(n)}const nn=o(x);function tn(n,t,e){return e.reduce(n,t)}const en=o(tn);function rn(n,t){return t.flatMap(n)}const un=o(rn);function cn(n,t){return t.find(n)}const on=o(cn);function fn(n,t){for(let e=0;e<t.length;e++)if(n(t[e]))return!0;return!1}const sn=o(fn);function ln(n,t){return t.every(n)}const an=o(ln);function dn(n,t){return n<=0?[]:n>=t.length?[...t]:t.slice(0,n)}const hn=o(dn);function yn(n,t){const e=Math.floor(n);return!Number.isFinite(e)||e<=0?t:t.slice(e)}const mn=o(yn);function pn(n,t){const e=[];let r=!0;for(const u of t)r&&!n(u)&&(r=!1),r||e.push(u);return e}const gn=o(pn);function An(n,t){const e=Math.floor(n);if(!Number.isFinite(e)||e<=0)return[];const r=[];for(let u=0;u<t.length;u+=e)r.push(t.slice(u,u+e));return r}const wn=o(An);function Sn(n,t){const e=Math.min(t.length,n.length),r=[];for(let u=0;u<e;u+=1)r.push([t[u],n[u]]);return r}const bn=o(Sn);function En(n,t,e){const r=Math.min(e.length,t.length),u=[];for(let c=0;c<r;c+=1)u.push(n(e[c],t[c]));return u}const On=o(En);function Pn(n){const t=[],e=[];for(const[r,u]of n)t.push(r),e.push(u);return[t,e]}function Tn(n){const t=new Set,e=[];for(const r of n)t.has(r)||(t.add(r),e.push(r));return e}function Mn(n,t){const e=new Set,r=[];for(const u of t){const c=n(u);e.has(c)||(e.add(c),r.push(u))}return r}const Nn=o(Mn);function kn(n,t){return[...t].sort((e,r)=>{const u=n(e),c=n(r);return u<c?-1:u>c?1:0})}const vn=o(kn);function zn(n,t){return[...t].sort(n)}const In=o(zn);function Wn(n,t){return t.reduce((e,r)=>{const u=n(r);return e[u]||(e[u]=[]),e[u].push(r),e},{})}const _n=o(Wn);function Dn(n){return n.map((t,e)=>[e,t])}function Ln(n,t){const e=[];for(const r of t){if(!n(r))break;e.push(r)}return e}const Cn=o(Ln);function Kn(n,t,e){const r=[];let u=t;for(const c of e)u=n(u,c),r.push(u);return r}const qn=o(Kn);function Bn(n,t){return[...t,...n]}const Fn=o(Bn);function Vn(n,t){return[...t,n]}const Rn=o(Vn);function $n(n,t){return[n,...t]}const Un=o($n);function jn(n){return n.flat()}function Hn(n){return n[0]}function Gn(n){return n.slice(1)}function Zn(n){if(n.length!==0)return n[n.length-1]}function Jn(n){return n.length<=1?[]:n.slice(0,-1)}function Qn(n,t){if(!Number.isFinite(n)||!Number.isFinite(t))return[];if(n===t)return[];const e=n<t?1:-1,r=[];for(let u=n;e>0?u<t:u>t;u+=e)r.push(u);return r}function Xn(n,t){const e=[],r=[];for(const u of t)n(u)?e.push(u):r.push(u);return[e,r]}const Yn=o(Xn);function xn(n){const t=[],e=r=>{for(const u of r)Array.isArray(u)?e(u):t.push(u)};return e(n),t}function nt(n,t){return t?.[n]}const tt=o(nt);function et(n,t){const e=t?.[n];if(e==null)throw new Error(`propStrict: "${String(n)}" is null or undefined`);return e}const rt=o(et);function it(n,t,e){const r=e?.[t];return r??n}const ut=o(it);function ct(n,t){return n.reduce((e,r)=>e?.[r],t)}const ot=o(ct);function ft(n,t,e){const r=t.reduce((u,c)=>u?.[c],e);return r??n}const st=o(ft);function lt(n,t){const e={};for(const r of n)r in t&&(e[r]=t[r]);return e}const at=o(lt);function dt(n,t){const e={...t};for(const r of n)delete e[r];return e}const ht=o(dt);function yt(n,t,e){if(Array.isArray(e)){const r=e.slice();return r[n]=t,r}return e&&typeof e=="object"?{...e,[n]:t}:{[n]:t}}const mt=o(yt),S=n=>typeof n=="number"?Number.isInteger(n):typeof n=="string"?/^-?\d+$/.test(n):!1,pt=(n,t)=>{const e=typeof n=="number"?n:Number(n);return Number.isNaN(e)?-1:e<0?Math.max(t+e,0):e},b=n=>n!==null&&typeof n=="object";function p(n,t,e){if(n.length===0)return t;const[r,...u]=n,c=S(r),f=Array.isArray(e)?e.slice():b(e)?{...e}:c?[]:{};if(Array.isArray(f)&&S(r)){const a=pt(r,f.length),A=f[a],w=u.length===0?t:p(u,t,A);return f[a]=w,f}const s=b(f)?f[r]:void 0,l=u.length===0?t:p(u,t,s);return f[r]=l,f}const gt=o(p);function At(n,t){if(Array.isArray(t)){const e=t.slice(),r=typeof n=="number"?n:Number.isNaN(Number(n))?-1:Number(n);return r>=0&&r<e.length?e.splice(r,1):delete e[n],e}if(t&&typeof t=="object"){const{[n]:e,...r}=t;return r}return t}const wt=n=>typeof n=="number"?Number.isInteger(n):typeof n=="string"?/^-?\d+$/.test(n):!1,St=(n,t)=>{const e=typeof n=="number"?n:Number(n);return Number.isNaN(e)?-1:e<0?t+e:e},bt=n=>n!==null&&typeof n=="object";function g(n,t){if(n.length===0||!bt(t))return t;const[e,...r]=n;if(Array.isArray(t)&&wt(e)){const c=St(e,t.length);if(c<0||c>=t.length)return t;const f=t.slice();if(r.length===0)return f.splice(c,1),f;const s=g(r,f[c]);return f[c]=s,f}if(!Object.prototype.hasOwnProperty.call(t,e))return t;if(r.length===0){const{[e]:c,...f}=t;return f}const u={...t};return u[e]=g(r,u[e]),u}const Et=o(g);function Ot(n,t){return{...n,...t}}const Pt=o(Ot);function Tt(n,t){const e=u=>typeof u=="object"&&u!==null&&!Array.isArray(u),r=(u,c)=>{const f={...u};for(const[s,l]of Object.entries(c)){const a=f[s];e(a)&&e(l)?f[s]=r(a,l):f[s]=l}return f};return e(n)&&e(t)?r(n,t):{...n,...t}}const Mt=o(Tt);function Nt(n){return n.reduce((e,r)=>({...e,...r}),{})}function kt(n){return Object.keys(n)}function vt(n){return Object.values(n)}function zt(n){return Object.entries(n)}function It(n){return t=>{const e={};for(const[r,u]of Object.entries(t))e[r]=n(u);return e}}function Wt(n,t){const e={...t};for(const r of Object.keys(n)){const u=n[r];typeof u=="function"&&(e[r]=u(t[r]))}return e}const _t=o(Wt);function Dt(n,t){return Object.prototype.hasOwnProperty.call(t,n)}const Lt=o(Dt);function Ct(n){return t=>{let e=t;for(const r of n){if(e==null||!Object.prototype.hasOwnProperty.call(e,r))return!1;e=e[r]}return!0}}function Kt(n,t){return y(n,t,new WeakMap)}function y(n,t,e){if(n===t||typeof n=="number"&&typeof t=="number"&&Number.isNaN(n)&&Number.isNaN(t))return!0;if(n===null||t===null||typeof n!="object"||typeof t!="object")return!1;if(e.has(n))return e.get(n)===t;if(e.set(n,t),n instanceof Date&&t instanceof Date)return n.getTime()===t.getTime();if(n instanceof Map&&t instanceof Map){if(n.size!==t.size)return!1;const c=Array.from(t.entries());for(const[f,s]of n.entries()){let l=!1;for(let a=0;a<c.length;a++){const[A,w]=c[a];if(y(f,A,e)&&y(s,w,e)){c.splice(a,1),l=!0;break}}if(!l)return!1}return!0}if(n instanceof Set&&t instanceof Set){if(n.size!==t.size)return!1;const c=Array.from(t.values());for(const f of n.values()){let s=!1;for(let l=0;l<c.length;l++)if(y(f,c[l],e)){c.splice(l,1),s=!0;break}if(!s)return!1}return!0}if(Array.isArray(n)&&Array.isArray(t)){if(n.length!==t.length)return!1;for(let c=0;c<n.length;c++)if(!y(n[c],t[c],e))return!1;return!0}const r=Reflect.ownKeys(n),u=Reflect.ownKeys(t);if(r.length!==u.length)return!1;for(const c of r)if(!Object.prototype.hasOwnProperty.call(t,c)||!y(n[c],t[c],e))return!1;return!0}const E=o(Kt);function qt(n){return n==null}function Bt(n){return n==null?!0:typeof n=="string"||Array.isArray(n)?n.length===0:n instanceof Map||n instanceof Set?n.size===0:typeof n=="object"?Object.keys(n).length===0:!1}function Ft(n){const t=n.toLowerCase();return e=>{if(e===null)return t==="null";if(e===void 0)return t==="undefined";const r=typeof e;return r!=="object"?r===t:Object.prototype.toString.call(e).slice(8,-1).toLowerCase()===t}}function Vt(n){return t=>t>n}function Rt(n){return t=>t>=n}function $t(n){return t=>t<n}function Ut(n){return t=>t<=n}function jt(n,t,e){return e<n?n:e>t?t:e}const Ht=o(jt);function Gt(n,t){if(typeof t=="string"&&typeof n=="string")return t.includes(n);if(Array.isArray(t)){for(let e=0;e<t.length;e++)if(E(t[e],n))return!0;return!1}return!1}function Zt(n,t){return n+t}const Jt=o(Zt);function Qt(n,t){return n-t}const Xt=o(Qt);function Yt(n,t){return n*t}const xt=o(Yt);function ne(n,t){return n/t}const te=o(ne);function ee(n){return n.reduce((t,e)=>t+e,0)}function re(n){return n.length===0?NaN:n.reduce((e,r)=>e+r,0)/n.length}function ie(n){return n.length===0?1/0:Math.min(...n)}function ue(n){return n.length===0?-1/0:Math.max(...n)}function ce(n){return Math.round(n)}function oe(n){return Math.floor(n)}function fe(n){return Math.ceil(n)}function se(n,t){const e=Math.ceil(n),r=Math.floor(t);return r<e?e:Math.floor(Math.random()*(r-e+1))+e}const le=o(se);function ae(n){return n.trim()}function de(n,t){return t.split(n)}const he=o(de);function ye(n,t){return t.join(n)}const me=o(ye);function pe(n,t,e){return e.replace(n,t)}const ge=o(pe);function Ae(n){return n.toUpperCase()}function we(n){return n.toLowerCase()}function Se(n,t){if(typeof t=="string"&&typeof n=="string")return t.startsWith(n);if(Array.isArray(n)&&Array.isArray(t)){if(n.length===0)return!0;if(n.length>t.length)return!1;for(let e=0;e<n.length;e++)if(t[e]!==n[e])return!1;return!0}return!1}function be(n,t){if(typeof t=="string"&&typeof n=="string")return t.endsWith(n);if(Array.isArray(n)&&Array.isArray(t)){if(n.length===0)return!0;if(n.length>t.length)return!1;for(let e=0;e<n.length;e++){const r=t.length-n.length+e;if(t[r]!==n[e])return!1}return!0}return!1}function Ee(n,t){return t.match(n)}const Oe=o(Ee);function Pe(...n){const t=async(u,c)=>{let f=u;for(const s of c)f=await s(f);return f};if(n.length===0)return Promise.resolve(void 0);const[e,...r]=n;if(typeof e=="function"){const u=[e,...r];return c=>t(c,u)}return t(e,r)}function Te(...n){const t=async(u,c)=>{let f=u;for(const s of c){if(h(f))return f;f=await s(f)}return f};if(n.length===0)return Promise.resolve(void 0);const[e,...r]=n;if(typeof e=="function"){const u=[e,...r];return c=>t(c,u)}return t(e,r)}function Me(...n){const t=async(u,c)=>{let f=u;for(const s of c){if(h(f))return f;f=await s(f)}return f};if(n.length===0)return Promise.resolve(void 0);const[e,...r]=n;if(typeof e=="function"){const u=[e,...r];return c=>t(c,u)}return t(e,r)}function O(n){return new Promise(t=>{setTimeout(t,n)})}function Ne(n,t){return new Promise((e,r)=>{const u=setTimeout(()=>r(new Error(`Timed out after ${n}ms`)),n);t.then(c=>{clearTimeout(u),e(c)}).catch(c=>{clearTimeout(u),r(c)})})}const ke=o(Ne);function ve(n,t,e=0){return(async()=>{let r=0;for(;;)try{return await t()}catch(u){if(r+=1,r>n)throw u;e>0&&await O(e)}})()}const ze=o(ve);function Ie(n,t){let e;return function(...u){e&&clearTimeout(e);const c=this;e=setTimeout(()=>{e=void 0,n.apply(c,u)},t)}}const We=o(Ie);function _e(n,t){let e;return function(...u){e||(n.apply(this,u),e=setTimeout(()=>{e=void 0},t))}}const De=o(_e);function Le(n,t){let e,r=!1,u,c;const f=()=>{e=void 0,r&&u&&(r=!1,n.apply(c,u))};return function(...l){if(!e){n.apply(this,l),e=setTimeout(f,t);return}r=!0,u=l,c=this,clearTimeout(e),e=setTimeout(f,t)}}const Ce=o(Le);function Ke(n,t){let e=0,r=null,u=null;const c=(s,l)=>{e=Date.now(),n.apply(s,l)};return function(...s){const l=Date.now(),a=t-(l-e);a<=0?(u&&(clearTimeout(u),u=null),r=null,c(this,s)):(r=s,u||(u=setTimeout(()=>{u=null,r&&(c(this,r),r=null)},a)))}}const qe=o(Ke);function Be(n){return t=>t==null?null:n(t)}function Fe(n){return t=>{const e=[];for(const r of t){const u=n(r);u!=null&&e.push(u)}return e}}function Ve(n){return t=>t??n}function Re(n){try{return{ok:!0,value:n()}}catch(t){return{ok:!1,error:t}}}function $e(n,t,e){return e==null?n():t(e)}const Ue=o($e);function je(n,t){if(!n)throw new Error(t??"Assertion failed")}const He=o(je);function Ge(n,t){if(!n)throw new Error(t??"Invariant failed")}const Ze=o(Ge);function Je(n){return t=>(n?console.log(n,t):console.log(t),t)}i.SideEffect=d,i.SideEffectClass=d,i.add=Jt,i.append=Rn,i.assert=He,i.assoc=mt,i.assocPath=gt,i.ceil=fe,i.chunk=wn,i.clamp=Ht,i.complement=W,i.compose=v,i.concat=Fn,i.cond=H,i.constant=D,i.curry=o,i.debounce=We,i.debounceLeading=De,i.debounceLeadingTrailing=Ce,i.delay=O,i.dissoc=At,i.dissocPath=Et,i.div=te,i.drop=mn,i.dropWhile=gn,i.endsWith=be,i.entries=zt,i.equals=E,i.every=an,i.evolve=_t,i.filter=nn,i.find=on,i.flatMap=un,i.flatten=jn,i.flattenDeep=xn,i.flip=I,i.floor=oe,i.fold=Ue,i.from=L,i.getOrElse=Ve,i.groupBy=_n,i.gt=Vt,i.gte=Rt,i.guard=Q,i.has=Lt,i.hasPath=Ct,i.head=Hn,i.identity=_,i.ifElse=V,i.includes=Gt,i.init=Jn,i.invariant=Ze,i.isEmpty=Bt,i.isNil=qt,i.isSideEffect=h,i.isType=Ft,i.join=me,i.keys=kt,i.last=Zn,i.log=Je,i.lt=$t,i.lte=Ut,i.map=Y,i.mapMaybe=Fe,i.mapValues=It,i.match=Oe,i.matchSideEffect=T,i.max=ue,i.maybe=Be,i.mean=re,i.memoize=B,i.merge=Pt,i.mergeAll=Nt,i.mergeDeep=Mt,i.min=ie,i.mul=xt,i.omit=ht,i.once=q,i.partial=z,i.partition=Yn,i.path=ot,i.pathOr=st,i.pick=at,i.pipe=m,i.pipeAsync=Pe,i.pipeAsyncSideEffect=Te,i.pipeAsyncSideEffectStrict=Me,i.pipeHint=P,i.pipeSideEffect=N,i.pipeSideEffectStrict=k,i.prepend=Un,i.prop=tt,i.propOr=ut,i.propStrict=rt,i.randomInt=le,i.range=Qn,i.reduce=en,i.replace=ge,i.result=Re,i.retry=ze,i.round=ce,i.runPipeResult=M,i.scan=qn,i.some=sn,i.sort=In,i.sortBy=vn,i.split=he,i.startsWith=Se,i.sub=Xt,i.sum=ee,i.tail=Gn,i.take=hn,i.takeWhile=Cn,i.tap=C,i.tap0=K,i.throttle=qe,i.timeout=ke,i.toLower=we,i.toUpper=Ae,i.trim=ae,i.tryCatch=Z,i.uniq=Tn,i.uniqBy=Nn,i.unless=j,i.unzip=Pn,i.values=vt,i.when=$,i.zip=bn,i.zipIndex=Dn,i.zipWith=On,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})}));
|
|
1
|
+
(function(i,m){typeof exports=="object"&&typeof module<"u"?m(exports):typeof define=="function"&&define.amd?define(["exports"],m):(i=typeof globalThis<"u"?globalThis:i||self,m(i.FpPack={}))})(this,(function(i){"use strict";function m(...n){if(n.length===0)return;const[t,...e]=n;if(typeof t=="function"){const r=[t,...e];return u=>r.reduce((c,o)=>o(c),u)}return e.reduce((r,u)=>u(r),t)}function P(n){return n}function T(n){return(...t)=>{if(typeof t[0]=="function"){const u=t;return c=>o=>{const s=u.map(l=>(a=>l(a,o)));return n(c,...s)}}const[e,...r]=t;return u=>{const c=r.map(o=>(s=>o(s,u)));return n(e,...c)}}}class d{effect;label;constructor(t,e){this.effect=t,this.label=e}static of(t,e){return new d(t,e)}}function M(n,t){return n instanceof d?t.effect(n):t.value(n)}function N(n){return h(n)?n.effect():n}function h(n){return n instanceof d}function k(...n){const t=(u,c)=>{let o=u;for(const s of c){if(h(o))return o;o=s(o)}return o};if(n.length===0)return;const[e,...r]=n;if(typeof e=="function"){const u=[e,...r];return c=>t(c,u)}return t(e,r)}function v(...n){const t=(u,c)=>{let o=u;for(const s of c){if(h(o))return o;o=s(o)}return o};if(n.length===0)return;const[e,...r]=n;if(typeof e=="function"){const u=[e,...r];return c=>t(c,u)}return t(e,r)}function z(...n){return t=>n.reduceRight((e,r)=>r(e),t)}function f(n,...t){const e=r=>r.length>=n.length?n(...r):(...u)=>e([...r,...u]);return t.length===0?e([]):e(t)}function W(n,...t){return function(...r){const u=[...t,...r];return n.apply(this,u)}}function D(n){return function(...e){const r=[...e].reverse();return n.apply(this,r)}}function I(n,...t){return t.length===0?(...e)=>!n(...e):!n(...t)}function _(n){return n}function L(n){return()=>n}function C(n){const t=e=>n;return Object.defineProperty(t,"__from",{value:!0}),t}function K(n){return t=>(n(t),t)}function q(n){return()=>{n()}}function B(n){let t=!1,e;return function(...u){return t||(t=!0,e=n.apply(this,u)),e}}function V(n){const t=new Map,e=Symbol("result");return function(...u){let c=t;for(const s of u)c.has(s)||c.set(s,new Map),c=c.get(s);if(c.has(e))return c.get(e);const o=n.apply(this,u);return c.set(e,o),o}}function F(n,t,e,r){return n(r)?t(r):e(r)}const R=f(F);function $(n,t,e){return n(e)?t(e):e}const U=f($);function j(n,t,e){return n(e)?e:t(e)}const H=f(j);function G(n){return t=>{for(const[e,r]of n)if(e(t))return r(t)}}function Z(n,t,e){try{return n(e)}catch(r){const u=r instanceof Error?r:new Error(String(r));return t(u,e)}}const J=f(Z);function Q(n,t,e){return n(e)?e:t}const X=f(Q);function Y(n,t){return t.map(n)}const x=f(Y);function nn(n,t){return t.filter(n)}const tn=f(nn);function en(n,t,e){return e.reduce(n,t)}const rn=f(en);function un(n,t){return t.flatMap(n)}const cn=f(un);function on(n,t){return t.find(n)}const fn=f(on);function sn(n,t){for(let e=0;e<t.length;e++)if(n(t[e]))return!0;return!1}const ln=f(sn);function an(n,t){return t.every(n)}const dn=f(an);function hn(n,t){return n<=0?[]:n>=t.length?[...t]:t.slice(0,n)}const yn=f(hn);function mn(n,t){const e=Math.floor(n);return!Number.isFinite(e)||e<=0?t:t.slice(e)}const pn=f(mn);function gn(n,t){const e=[];let r=!0;for(const u of t)r&&!n(u)&&(r=!1),r||e.push(u);return e}const wn=f(gn);function An(n,t){const e=Math.floor(n);if(!Number.isFinite(e)||e<=0)return[];const r=[];for(let u=0;u<t.length;u+=e)r.push(t.slice(u,u+e));return r}const Sn=f(An);function bn(n,t){const e=Math.min(t.length,n.length),r=[];for(let u=0;u<e;u+=1)r.push([t[u],n[u]]);return r}const En=f(bn);function On(n,t,e){const r=Math.min(e.length,t.length),u=[];for(let c=0;c<r;c+=1)u.push(n(e[c],t[c]));return u}const Pn=f(On);function Tn(n){const t=[],e=[];for(const[r,u]of n)t.push(r),e.push(u);return[t,e]}function Mn(n){const t=new Set,e=[];for(const r of n)t.has(r)||(t.add(r),e.push(r));return e}function Nn(n,t){const e=new Set,r=[];for(const u of t){const c=n(u);e.has(c)||(e.add(c),r.push(u))}return r}const kn=f(Nn);function vn(n,t){return[...t].sort((e,r)=>{const u=n(e),c=n(r);return u<c?-1:u>c?1:0})}const zn=f(vn);function Wn(n,t){return[...t].sort(n)}const Dn=f(Wn);function In(n,t){return t.reduce((e,r)=>{const u=n(r);return e[u]||(e[u]=[]),e[u].push(r),e},{})}const _n=f(In);function Ln(n){return n.map((t,e)=>[e,t])}function Cn(n,t){const e=[];for(const r of t){if(!n(r))break;e.push(r)}return e}const Kn=f(Cn);function qn(n,t,e){const r=[];let u=t;for(const c of e)u=n(u,c),r.push(u);return r}const Bn=f(qn);function Vn(n,t){return[...t,...n]}const Fn=f(Vn);function Rn(n,t){return[...t,n]}const $n=f(Rn);function Un(n,t){return[n,...t]}const jn=f(Un);function Hn(n){return n.flat()}function Gn(n){return n[0]}function Zn(n){return n.slice(1)}function Jn(n){if(n.length!==0)return n[n.length-1]}function Qn(n){return n.length<=1?[]:n.slice(0,-1)}function Xn(n,t){if(!Number.isFinite(n)||!Number.isFinite(t))return[];if(n===t)return[];const e=n<t?1:-1,r=[];for(let u=n;e>0?u<t:u>t;u+=e)r.push(u);return r}function Yn(n,t){const e=[],r=[];for(const u of t)n(u)?e.push(u):r.push(u);return[e,r]}const xn=f(Yn);function nt(n){const t=[],e=r=>{for(const u of r)Array.isArray(u)?e(u):t.push(u)};return e(n),t}function tt(n,t){return t?.[n]}const et=f(tt);function rt(n,t){const e=t?.[n];if(e==null)throw new Error(`propStrict: "${String(n)}" is null or undefined`);return e}const it=f(rt);function ut(n,t,e){const r=e?.[t];return r??n}const ct=f(ut);function ot(n,t){return n.reduce((e,r)=>e?.[r],t)}const ft=f(ot);function st(n,t,e){const r=t.reduce((u,c)=>u?.[c],e);return r??n}const lt=f(st);function at(n,t){const e={};for(const r of n)r in t&&(e[r]=t[r]);return e}const dt=f(at);function ht(n,t){const e={...t};for(const r of n)delete e[r];return e}const yt=f(ht);function mt(n,t,e){if(Array.isArray(e)){const r=e.slice();return r[n]=t,r}return e&&typeof e=="object"?{...e,[n]:t}:{[n]:t}}const pt=f(mt),S=n=>typeof n=="number"?Number.isInteger(n):typeof n=="string"?/^-?\d+$/.test(n):!1,gt=(n,t)=>{const e=typeof n=="number"?n:Number(n);return Number.isNaN(e)?-1:e<0?Math.max(t+e,0):e},b=n=>n!==null&&typeof n=="object";function p(n,t,e){if(n.length===0)return t;const[r,...u]=n,c=S(r),o=Array.isArray(e)?e.slice():b(e)?{...e}:c?[]:{};if(Array.isArray(o)&&S(r)){const a=gt(r,o.length),w=o[a],A=u.length===0?t:p(u,t,w);return o[a]=A,o}const s=b(o)?o[r]:void 0,l=u.length===0?t:p(u,t,s);return o[r]=l,o}const wt=f(p);function At(n,t){if(Array.isArray(t)){const e=t.slice(),r=typeof n=="number"?n:Number.isNaN(Number(n))?-1:Number(n);return r>=0&&r<e.length?e.splice(r,1):delete e[n],e}if(t&&typeof t=="object"){const{[n]:e,...r}=t;return r}return t}const St=n=>typeof n=="number"?Number.isInteger(n):typeof n=="string"?/^-?\d+$/.test(n):!1,bt=(n,t)=>{const e=typeof n=="number"?n:Number(n);return Number.isNaN(e)?-1:e<0?t+e:e},Et=n=>n!==null&&typeof n=="object";function g(n,t){if(n.length===0||!Et(t))return t;const[e,...r]=n;if(Array.isArray(t)&&St(e)){const c=bt(e,t.length);if(c<0||c>=t.length)return t;const o=t.slice();if(r.length===0)return o.splice(c,1),o;const s=g(r,o[c]);return o[c]=s,o}if(!Object.prototype.hasOwnProperty.call(t,e))return t;if(r.length===0){const{[e]:c,...o}=t;return o}const u={...t};return u[e]=g(r,u[e]),u}const Ot=f(g);function Pt(n,t){return{...n,...t}}const Tt=f(Pt);function Mt(n,t){const e=u=>typeof u=="object"&&u!==null&&!Array.isArray(u),r=(u,c)=>{const o={...u};for(const[s,l]of Object.entries(c)){const a=o[s];e(a)&&e(l)?o[s]=r(a,l):o[s]=l}return o};return e(n)&&e(t)?r(n,t):{...n,...t}}const Nt=f(Mt);function kt(n){return n.reduce((e,r)=>({...e,...r}),{})}function vt(n){return Object.keys(n)}function zt(n){return Object.values(n)}function Wt(n){return Object.entries(n)}function Dt(n){return t=>{const e={};for(const[r,u]of Object.entries(t))e[r]=n(u);return e}}function It(n,t){const e={...t};for(const r of Object.keys(n)){const u=n[r];typeof u=="function"&&(e[r]=u(t[r]))}return e}const _t=f(It);function Lt(n,t){return Object.prototype.hasOwnProperty.call(t,n)}const Ct=f(Lt);function Kt(n){return t=>{let e=t;for(const r of n){if(e==null||!Object.prototype.hasOwnProperty.call(e,r))return!1;e=e[r]}return!0}}function qt(n,t){return y(n,t,new WeakMap)}function y(n,t,e){if(n===t||typeof n=="number"&&typeof t=="number"&&Number.isNaN(n)&&Number.isNaN(t))return!0;if(n===null||t===null||typeof n!="object"||typeof t!="object")return!1;if(e.has(n))return e.get(n)===t;if(e.set(n,t),n instanceof Date&&t instanceof Date)return n.getTime()===t.getTime();if(n instanceof Map&&t instanceof Map){if(n.size!==t.size)return!1;const c=Array.from(t.entries());for(const[o,s]of n.entries()){let l=!1;for(let a=0;a<c.length;a++){const[w,A]=c[a];if(y(o,w,e)&&y(s,A,e)){c.splice(a,1),l=!0;break}}if(!l)return!1}return!0}if(n instanceof Set&&t instanceof Set){if(n.size!==t.size)return!1;const c=Array.from(t.values());for(const o of n.values()){let s=!1;for(let l=0;l<c.length;l++)if(y(o,c[l],e)){c.splice(l,1),s=!0;break}if(!s)return!1}return!0}if(Array.isArray(n)&&Array.isArray(t)){if(n.length!==t.length)return!1;for(let c=0;c<n.length;c++)if(!y(n[c],t[c],e))return!1;return!0}const r=Reflect.ownKeys(n),u=Reflect.ownKeys(t);if(r.length!==u.length)return!1;for(const c of r)if(!Object.prototype.hasOwnProperty.call(t,c)||!y(n[c],t[c],e))return!1;return!0}const E=f(qt);function Bt(n){return n==null}function Vt(n){return n==null?!0:typeof n=="string"||Array.isArray(n)?n.length===0:n instanceof Map||n instanceof Set?n.size===0:typeof n=="object"?Object.keys(n).length===0:!1}function Ft(n){const t=n.toLowerCase();return e=>{if(e===null)return t==="null";if(e===void 0)return t==="undefined";const r=typeof e;return r!=="object"?r===t:Object.prototype.toString.call(e).slice(8,-1).toLowerCase()===t}}function Rt(n){return t=>t>n}function $t(n){return t=>t>=n}function Ut(n){return t=>t<n}function jt(n){return t=>t<=n}function Ht(n,t,e){return e<n?n:e>t?t:e}const Gt=f(Ht);function Zt(n,t){if(typeof t=="string"&&typeof n=="string")return t.includes(n);if(Array.isArray(t)){for(let e=0;e<t.length;e++)if(E(t[e],n))return!0;return!1}return!1}function Jt(n,t){return n+t}const Qt=f(Jt);function Xt(n,t){return n-t}const Yt=f(Xt);function xt(n,t){return n*t}const ne=f(xt);function te(n,t){return n/t}const ee=f(te);function re(n){return n.reduce((t,e)=>t+e,0)}function ie(n){return n.length===0?NaN:n.reduce((e,r)=>e+r,0)/n.length}function ue(n){return n.length===0?1/0:Math.min(...n)}function ce(n){return n.length===0?-1/0:Math.max(...n)}function oe(n){return Math.round(n)}function fe(n){return Math.floor(n)}function se(n){return Math.ceil(n)}function le(n,t){const e=Math.ceil(n),r=Math.floor(t);return r<e?e:Math.floor(Math.random()*(r-e+1))+e}const ae=f(le);function de(n){return n.trim()}function he(n,t){return t.split(n)}const ye=f(he);function me(n,t){return t.join(n)}const pe=f(me);function ge(n,t,e){return e.replace(n,t)}const we=f(ge);function Ae(n){return n.toUpperCase()}function Se(n){return n.toLowerCase()}function be(n,t){if(typeof t=="string"&&typeof n=="string")return t.startsWith(n);if(Array.isArray(n)&&Array.isArray(t)){if(n.length===0)return!0;if(n.length>t.length)return!1;for(let e=0;e<n.length;e++)if(t[e]!==n[e])return!1;return!0}return!1}function Ee(n,t){if(typeof t=="string"&&typeof n=="string")return t.endsWith(n);if(Array.isArray(n)&&Array.isArray(t)){if(n.length===0)return!0;if(n.length>t.length)return!1;for(let e=0;e<n.length;e++){const r=t.length-n.length+e;if(t[r]!==n[e])return!1}return!0}return!1}function Oe(n,t){return t.match(n)}const Pe=f(Oe);function Te(...n){const t=async(u,c)=>{let o=u;for(const s of c)o=await s(o);return o};if(n.length===0)return Promise.resolve(void 0);const[e,...r]=n;if(typeof e=="function"){const u=[e,...r];return c=>t(c,u)}return t(e,r)}function Me(...n){const t=async(u,c)=>{let o=u;for(const s of c){if(h(o))return o;o=await s(o)}return o};if(n.length===0)return Promise.resolve(void 0);const[e,...r]=n;if(typeof e=="function"){const u=[e,...r];return c=>t(c,u)}return t(e,r)}function Ne(...n){const t=async(u,c)=>{let o=u;for(const s of c){if(h(o))return o;o=await s(o)}return o};if(n.length===0)return Promise.resolve(void 0);const[e,...r]=n;if(typeof e=="function"){const u=[e,...r];return c=>t(c,u)}return t(e,r)}function O(n){return new Promise(t=>{setTimeout(t,n)})}function ke(n,t){return new Promise((e,r)=>{const u=setTimeout(()=>r(new Error(`Timed out after ${n}ms`)),n);t.then(c=>{clearTimeout(u),e(c)}).catch(c=>{clearTimeout(u),r(c)})})}const ve=f(ke);function ze(n,t,e=0){return(async()=>{let r=0;for(;;)try{return await t()}catch(u){if(r+=1,r>n)throw u;e>0&&await O(e)}})()}const We=f(ze);function De(n,t){let e;return function(...u){e&&clearTimeout(e);const c=this;e=setTimeout(()=>{e=void 0,n.apply(c,u)},t)}}const Ie=f(De);function _e(n,t){let e;return function(...u){e||(n.apply(this,u),e=setTimeout(()=>{e=void 0},t))}}const Le=f(_e);function Ce(n,t){let e,r=!1,u,c;const o=()=>{e=void 0,r&&u&&(r=!1,n.apply(c,u))};return function(...l){if(!e){n.apply(this,l),e=setTimeout(o,t);return}r=!0,u=l,c=this,clearTimeout(e),e=setTimeout(o,t)}}const Ke=f(Ce);function qe(n,t){let e=0,r=null,u=null;const c=(s,l)=>{e=Date.now(),n.apply(s,l)};return function(...s){const l=Date.now(),a=t-(l-e);a<=0?(u&&(clearTimeout(u),u=null),r=null,c(this,s)):(r=s,u||(u=setTimeout(()=>{u=null,r&&(c(this,r),r=null)},a)))}}const Be=f(qe);function Ve(n){return t=>t==null?null:n(t)}function Fe(n){return t=>{const e=[];for(const r of t){const u=n(r);u!=null&&e.push(u)}return e}}function Re(n){return t=>t??n}function $e(n){try{return{ok:!0,value:n()}}catch(t){return{ok:!1,error:t}}}function Ue(n,t,e){return e==null?n():t(e)}const je=f(Ue);function He(n,t){if(!n)throw new Error(t??"Assertion failed")}const Ge=f(He);function Ze(n,t){if(!n)throw new Error(t??"Invariant failed")}const Je=f(Ze);function Qe(n){return t=>(n?console.log(n,t):console.log(t),t)}i.SideEffect=d,i.SideEffectClass=d,i.add=Qt,i.append=$n,i.assert=Ge,i.assoc=pt,i.assocPath=wt,i.ceil=se,i.chunk=Sn,i.clamp=Gt,i.complement=I,i.compose=z,i.concat=Fn,i.cond=G,i.constant=L,i.curry=f,i.debounce=Ie,i.debounceLeading=Le,i.debounceLeadingTrailing=Ke,i.delay=O,i.dissoc=At,i.dissocPath=Ot,i.div=ee,i.drop=pn,i.dropWhile=wn,i.endsWith=Ee,i.entries=Wt,i.equals=E,i.every=dn,i.evolve=_t,i.filter=tn,i.find=fn,i.flatMap=cn,i.flatten=Hn,i.flattenDeep=nt,i.flip=D,i.floor=fe,i.fold=je,i.from=C,i.getOrElse=Re,i.groupBy=_n,i.gt=Rt,i.gte=$t,i.guard=X,i.has=Ct,i.hasPath=Kt,i.head=Gn,i.identity=_,i.ifElse=R,i.includes=Zt,i.init=Qn,i.invariant=Je,i.isEmpty=Vt,i.isNil=Bt,i.isSideEffect=h,i.isType=Ft,i.join=pe,i.keys=vt,i.last=Jn,i.log=Qe,i.lt=Ut,i.lte=jt,i.map=x,i.mapMaybe=Fe,i.mapValues=Dt,i.match=Pe,i.matchSideEffect=M,i.max=ce,i.maybe=Ve,i.mean=ie,i.memoize=V,i.merge=Tt,i.mergeAll=kt,i.mergeDeep=Nt,i.min=ue,i.mul=ne,i.omit=yt,i.once=B,i.partial=W,i.partition=xn,i.path=ft,i.pathOr=lt,i.pick=dt,i.pipe=m,i.pipeAsync=Te,i.pipeAsyncSideEffect=Me,i.pipeAsyncSideEffectStrict=Ne,i.pipeHint=P,i.pipeSideEffect=k,i.pipeSideEffectStrict=v,i.pipeWithDeps=T,i.prepend=jn,i.prop=et,i.propOr=ct,i.propStrict=it,i.randomInt=ae,i.range=Xn,i.reduce=rn,i.replace=we,i.result=$e,i.retry=We,i.round=oe,i.runPipeResult=N,i.scan=Bn,i.some=ln,i.sort=Dn,i.sortBy=zn,i.split=ye,i.startsWith=be,i.sub=Yt,i.sum=re,i.tail=Zn,i.take=yn,i.takeWhile=Kn,i.tap=K,i.tap0=q,i.throttle=Be,i.timeout=ve,i.toLower=Se,i.toUpper=Ae,i.trim=de,i.tryCatch=J,i.uniq=Mn,i.uniqBy=kn,i.unless=H,i.unzip=Tn,i.values=zt,i.when=U,i.zip=En,i.zipIndex=Ln,i.zipWith=Pn,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})}));
|
|
2
2
|
//# sourceMappingURL=fp-pack.umd.js.map
|