@statedelta-libs/operators 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +354 -150
- package/dist/index.d.ts +354 -150
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -413,6 +413,27 @@ transduce(xform, (acc, x) => acc + x, 0, [1, 2, 3, 4, 5, 6, 7]);
|
|
|
413
413
|
|
|
414
414
|
---
|
|
415
415
|
|
|
416
|
+
## Scope
|
|
417
|
+
|
|
418
|
+
All pure functions are available as a single `scope` object, useful when you need to pass operators as a `Record<string, Function>` (e.g., for JSON DSL evaluation):
|
|
419
|
+
|
|
420
|
+
```typescript
|
|
421
|
+
import { scope } from '@statedelta-libs/operators';
|
|
422
|
+
|
|
423
|
+
// scope contains all 176 functions, no placeholders or non-function values
|
|
424
|
+
// Type-safe: satisfies Record<string, (...args: any[]) => any>
|
|
425
|
+
|
|
426
|
+
// Use with DSL engines that expect a function-only scope
|
|
427
|
+
evaluate(expression, scope);
|
|
428
|
+
|
|
429
|
+
// Or pick what you need
|
|
430
|
+
const { map, filter, sum } = scope;
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
> **Note:** `__` (placeholder) and `isPlaceholder` are **not** included in `scope` since they are not functions. Import them directly when needed.
|
|
434
|
+
|
|
435
|
+
---
|
|
436
|
+
|
|
416
437
|
## TypeScript
|
|
417
438
|
|
|
418
439
|
Full type inference throughout:
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';function v(n){return n}function E(n){return function(){return n}}function F(){return true}function V(){return false}var w=Symbol.for("@@statedelta/placeholder"),D={[w]:true,__:w};function c(n){return n!==null&&typeof n=="object"&&w in n&&n[w]===true}function p(n){return function e(r){return arguments.length===0?e:n(r)}}function l(n){return function e(r,t){switch(arguments.length){case 0:return e;case 1:return c(r)?e:p(o=>n(r,o));default:return c(r)&&c(t)?e:c(r)?p(o=>n(o,t)):c(t)?p(o=>n(r,o)):n(r,t)}}}var j=l(function(e,r){return e(r),r});function k(n){return function e(r,t,o){switch(arguments.length){case 0:return e;case 1:return c(r)?e:l((s,T)=>n(r,s,T));case 2:return c(r)&&c(t)?e:c(r)?l((s,T)=>n(s,t,T)):c(t)?l((s,T)=>n(r,s,T)):p(s=>n(r,t,s));default:let u=c(r),i=c(t),a=c(o),d=(u?1:0)+(i?1:0)+(a?1:0);return d===3?e:d===2?u?i?l((s,T)=>n(s,T,o)):l((s,T)=>n(s,t,T)):l((s,T)=>n(r,s,T)):d===1?u?p(s=>n(s,t,o)):i?p(s=>n(r,s,o)):p(s=>n(r,t,s)):n(r,t,o)}}}function A(n,e,r){return function t(...o){if(o.length===0)return t;let u=[],i=0;for(let d=0;d<e.length;d++)c(e[d])&&i<o.length?(u.push(o[i]),i++):u.push(e[d]);for(;i<o.length;)u.push(o[i]),i++;let a=0;for(let d=0;d<Math.min(u.length,n);d++)c(u[d])||a++;return a>=n?r.apply(this,u.slice(0,n)):A(n,u,r)}}function N(n){let e=n.length;switch(e){case 0:return n;case 1:return p(n);case 2:return l(n);case 3:return k(n);default:return A(e,[],n)}}function O(n,e){if(n<0)throw new Error(`curryN: arity must be non-negative, got ${n}`);if(n>10)throw new Error(`curryN: arity must be at most 10, got ${n}`);switch(n){case 0:return e;case 1:return p(e);case 2:return l(e);case 3:return k(e);default:return A(n,[],e)}}function L(n,e){return function(...t){let o=[],u=0;for(let i=0;i<e.length;i++)c(e[i])&&u<t.length?(o.push(t[u]),u++):o.push(e[i]);for(;u<t.length;)o.push(t[u]),u++;return n(...o)}}function W(n,e){return function(...t){return n(...t,...e)}}var I=function(e,...r){let t=e;for(let o=0;o<r.length;o++)t=r[o](t);return t},_=function(...e){return e.length===0?r=>r:e.length===1?e[0]:function(t){let o=t;for(let u=0;u<e.length;u++)o=e[u](o);return o}};var q=function(...e){return e.length===0?r=>r:e.length===1?e[0]:function(t){let o=t;for(let u=e.length-1;u>=0;u--)o=e[u](o);return o}};function M(n,e){return e.length===0?(r=>r):function(t){let o=t;for(let u=0;u<e.length;u++)o=n(e[u],o);return o}}function z(...n){return async function(r){let t=r;for(let o=0;o<n.length;o++)t=await n[o](t);return t}}function H(...n){return async function(r){let t=r;for(let o=n.length-1;o>=0;o--)t=await n[o](t);return t}}function $(...n){return e=>r=>n.reduce((t,o)=>o(t)(r),e)}function Y(...n){return e=>r=>n.reduceRight((t,o)=>o(t)(r),e)}function dr(n,e){let r={...e};for(let[t,o]of Object.entries(n))r[t]=typeof o=="function"?o(r):o;return r}function U(n,e,r){let t=dr(n,r);return e(t)}function G(n,e,r){return e!==void 0&&r!==void 0?U(n,e,r):e!==void 0?t=>U(n,e,t):(t,o)=>o!==void 0?U(n,t,o):u=>U(n,t,u)}var J=l((n,e)=>{let r=e.length,t=new Array(r);for(let o=0;o<r;o++)t[o]=n(e[o],o,e);return t});var Q=l((n,e)=>{let r=[],t=e.length;for(let o=0;o<t;o++)n(e[o],o,e)&&r.push(e[o]);return r}),X=l((n,e)=>{let r=[],t=e.length;for(let o=0;o<t;o++)n(e[o],o,e)||r.push(e[o]);return r});var Z=k((n,e,r)=>{let t=e,o=r.length;for(let u=0;u<o;u++)t=n(t,r[u],u,r);return t}),nn=k((n,e,r)=>{let t=e;for(let o=r.length-1;o>=0;o--)t=n(t,r[o],o,r);return t});function en(n){return n[0]}function rn(n){return n.slice(1)}function tn(n){return n[n.length-1]}function on(n){return n.slice(0,-1)}function un(n,e){if(e===void 0)return t=>{let o=n<0?t.length+n:n;return t[o]};let r=n<0?e.length+n:n;return e[r]}function an(n,e){return e===void 0?r=>r.slice(0,Math.max(0,n)):e.slice(0,Math.max(0,n))}function dn(n,e){return e===void 0?r=>n<=0?[]:r.slice(-n):n<=0?[]:e.slice(-n)}function sn(n,e){let r=t=>{let o=[];for(let u=0;u<t.length&&n(t[u],u,t);u++)o.push(t[u]);return o};return e===void 0?r:r(e)}function cn(n,e){return e===void 0?r=>r.slice(Math.max(0,n)):e.slice(Math.max(0,n))}function ln(n,e){return e===void 0?r=>n<=0?r.slice():r.slice(0,-n):n<=0?e.slice():e.slice(0,-n)}function fn(n,e){let r=t=>{let o=0;for(;o<t.length&&n(t[o],o,t);)o++;return t.slice(o)};return e===void 0?r:r(e)}function Tn(n,e,r){return e!==void 0&&r!==void 0?r.slice(n,e):e!==void 0?t=>t.slice(n,e):function(o,u){return u!==void 0?u.slice(n,o):i=>i.slice(n,o)}}function pn(n,e){let r=t=>{for(let o=0;o<t.length;o++)if(n(t[o],o,t))return t[o]};return e===void 0?r:r(e)}function yn(n,e){let r=t=>{for(let o=0;o<t.length;o++)if(n(t[o],o,t))return o;return -1};return e===void 0?r:r(e)}function mn(n,e){let r=t=>{for(let o=t.length-1;o>=0;o--)if(n(t[o],o,t))return t[o]};return e===void 0?r:r(e)}function xn(n,e){let r=t=>{for(let o=0;o<t.length;o++)if(t[o]===n)return o;return -1};return e===void 0?r:r(e)}function bn(n,e){let r=t=>{for(let o=0;o<t.length;o++)if(t[o]===n)return true;return false};return e===void 0?r:r(e)}function K(n){let e=[];for(let r=0;r<n.length;r++){let t=n[r];if(Array.isArray(t))for(let o=0;o<t.length;o++)e.push(t[o]);else e.push(t);}return e}var gn=K;function Rn(n,e){let r=t=>{let o=[];for(let u=0;u<t.length;u++){let i=n(t[u],u,t);for(let a=0;a<i.length;a++)o.push(i[a]);}return o};return e===void 0?r:r(e)}function kn(n){let e=new Set,r=[];for(let t=0;t<n.length;t++){let o=n[t];e.has(o)||(e.add(o),r.push(o));}return r}function An(n,e){let r=t=>{let o=new Set,u=[];for(let i=0;i<t.length;i++){let a=t[i],d=n(a);o.has(d)||(o.add(d),u.push(a));}return u};return e===void 0?r:r(e)}function hn(n,e){return e===void 0?r=>[...r].sort(n):[...e].sort(n)}function wn(n,e){let r=(t,o)=>{let u=n(t),i=n(o);return u<i?-1:u>i?1:0};return e===void 0?t=>[...t].sort(r):[...e].sort(r)}function Un(n){let e=new Array(n.length);for(let r=0;r<n.length;r++)e[n.length-1-r]=n[r];return e}function Cn(n,e){let r=t=>{let o={};for(let u=0;u<t.length;u++){let i=t[u],a=n(i);a in o||(o[a]=[]),o[a].push(i);}return o};return e===void 0?r:r(e)}function Sn(n,e){return e===void 0?r=>[...n,...r]:[...n,...e]}function Kn(n,e){return e===void 0?r=>[...r,n]:[...e,n]}function Bn(n,e){return e===void 0?r=>[n,...r]:[n,...e]}function Pn(n,e){if(e===void 0)return o=>{let u=Math.min(n.length,o.length),i=new Array(u);for(let a=0;a<u;a++)i[a]=[n[a],o[a]];return i};let r=Math.min(n.length,e.length),t=new Array(r);for(let o=0;o<r;o++)t[o]=[n[o],e[o]];return t}function vn(n,e,r){if(e!==void 0&&r!==void 0){let t=Math.min(e.length,r.length),o=new Array(t);for(let u=0;u<t;u++)o[u]=n(e[u],r[u]);return o}return e!==void 0?t=>{let o=Math.min(e.length,t.length),u=new Array(o);for(let i=0;i<o;i++)u[i]=n(e[i],t[i]);return u}:function(o,u){if(u!==void 0){let i=Math.min(o.length,u.length),a=new Array(i);for(let d=0;d<i;d++)a[d]=n(o[d],u[d]);return a}return i=>{let a=Math.min(o.length,i.length),d=new Array(a);for(let s=0;s<a;s++)d[s]=n(o[s],i[s]);return d}}}function En(n,e){if(e===void 0)return o=>{let u={},i=Math.min(n.length,o.length);for(let a=0;a<i;a++)u[n[a]]=o[a];return u};let r={},t=Math.min(n.length,e.length);for(let o=0;o<t;o++)r[n[o]]=e[o];return r}function Fn(n,e){let r=t=>{for(let o=0;o<t.length;o++)if(n(t[o],o,t))return true;return false};return e===void 0?r:r(e)}function Vn(n,e){let r=t=>{for(let o=0;o<t.length;o++)if(!n(t[o],o,t))return false;return true};return e===void 0?r:r(e)}function Dn(n,e){let r=t=>{for(let o=0;o<t.length;o++)if(n(t[o],o,t))return false;return true};return e===void 0?r:r(e)}function jn(n){return n.length}function Nn(n){let e=0;for(let r=0;r<n.length;r++)e+=n[r];return e}function On(n){if(n.length===0)return 1;let e=1;for(let r=0;r<n.length;r++)e*=n[r];return e}function Ln(n){if(n.length===0)return NaN;let e=0;for(let r=0;r<n.length;r++)e+=n[r];return e/n.length}function Wn(n){if(n.length===0)return NaN;let e=[...n].sort((t,o)=>t-o),r=Math.floor(e.length/2);return e.length%2===0?(e[r-1]+e[r])/2:e[r]}function In(n){if(n.length===0)return 1/0;let e=n[0];for(let r=1;r<n.length;r++)n[r]<e&&(e=n[r]);return e}function _n(n){if(n.length===0)return -1/0;let e=n[0];for(let r=1;r<n.length;r++)n[r]>e&&(e=n[r]);return e}function qn(n,e){let r=t=>{let o={};for(let u=0;u<t.length;u++){let i=n(t[u]);o[i]=(o[i]||0)+1;}return o};return e===void 0?r:r(e)}function Mn(n,e){if(e===void 0)return t=>{if(n>=t)return [];let o=new Array(t-n);for(let u=0;u<o.length;u++)o[u]=n+u;return o};if(n>=e)return [];let r=new Array(e-n);for(let t=0;t<r.length;t++)r[t]=n+t;return r}function zn(n,e){let r=t=>{let o=[],u=[];for(let i=0;i<t.length;i++)n(t[i],i,t)?o.push(t[i]):u.push(t[i]);return [o,u]};return e===void 0?r:r(e)}function Hn(n,e){if(e===void 0)return t=>{if(n<=0)return [];let o=[];for(let u=0;u<t.length;u+=n)o.push(t.slice(u,u+n));return o};if(n<=0)return [];let r=[];for(let t=0;t<e.length;t+=n)r.push(e.slice(t,t+n));return r}function $n(n,e){let r=t=>{let o={};for(let u=0;u<t.length;u++){let i=n(t[u]);o[i]=t[u];}return o};return e===void 0?r:r(e)}function Yn(n,e){return e===void 0?r=>r[n]:e[n]}function f(n,e){if(e===void 0)return t=>f(n,t);let r=e;for(let t of n){if(r==null)return;r=r[t];}return r}function Gn(n,e,r){if(e===void 0)return (o,u)=>{if(u===void 0)return a=>{let d=a[o];return d??n};let i=u[o];return i??n};if(r===void 0)return o=>{let u=o[e];return u??n};let t=r[e];return t??n}function Jn(n,e,r){if(e===void 0)return (o,u)=>{if(u===void 0)return a=>{let d=f(o,a);return d??n};let i=f(o,u);return i??n};if(r===void 0)return o=>{let u=f(e,o);return u??n};let t=f(e,r);return t??n}function Qn(n,e){return e===void 0?r=>n.map(t=>r[t]):n.map(r=>e[r])}function Xn(n,e){return e===void 0?r=>r.map(t=>t[n]):e.map(r=>r[n])}function Zn(n,e,r){return e===void 0?(t,o)=>o===void 0?u=>({...u,[n]:t}):{...o,[n]:t}:r===void 0?t=>({...t,[n]:e}):{...r,[n]:e}}function g(n,e,r){if(n.length===0)return e;let[t,...o]=n,u=typeof t=="number";if(r==null){let a=u?[]:{};if(o.length===0){if(u){let d=a;return d[t]=e,d}return {...a,[t]:e}}if(u){let d=a;return d[t]=g(o,e,void 0),d}return {...a,[t]:g(o,e,void 0)}}if(Array.isArray(r)){let a=[...r];return a[t]=o.length===0?e:g(o,e,r[t]),a}let i=r;return {...i,[t]:o.length===0?e:g(o,e,i[t])}}function ne(n,e,r){return e===void 0?(t,o)=>o===void 0?u=>g(n,t,u):g(n,t,o):r===void 0?t=>g(n,e,t):g(n,e,r)}function ee(n,e){if(e===void 0)return o=>{let{[n]:u,...i}=o;return i};let{[n]:r,...t}=e;return t}function C(n,e){if(n.length===0||e===null||e===void 0)return e;let[r,...t]=n;if(t.length===0){if(Array.isArray(e)){let a=[...e];return a.splice(r,1),a}let{[r]:u,...i}=e;return i}if(Array.isArray(e)){let u=[...e];return u[r]=C(t,e[r]),u}let o=e;return {...o,[r]:C(t,o[r])}}function re(n,e){return e===void 0?r=>C(n,r):C(n,e)}function te(n,e){if(e===void 0)return t=>{let o={};for(let u of n)u in t&&(o[u]=t[u]);return o};let r={};for(let t of n)t in e&&(r[t]=e[t]);return r}function oe(n,e){let r=new Set(n);if(e===void 0)return o=>{let u={};for(let i in o)r.has(i)||(u[i]=o[i]);return u};let t={};for(let o in e)r.has(o)||(t[o]=e[o]);return t}function ue(n,e){return e===void 0?r=>({...n,...r}):{...n,...e}}function h(n){return n!==null&&typeof n=="object"&&!Array.isArray(n)}function ie(n,e){let r=(t,o)=>{let u={...t};for(let i in o)h(t[i])&&h(o[i])?u[i]=r(t[i],o[i]):u[i]=o[i];return u};return e===void 0?t=>r(n,t):r(n,e)}function ae(n,e){let r=(t,o)=>{let u={...o};for(let i in t)if(i in o){let a=t[i];typeof a=="function"?u[i]=a(o[i]):h(a)&&h(o[i])&&(u[i]=r(a,o[i]));}return u};return e===void 0?t=>r(n,t):r(n,e)}function de(n){let e=(r,t)=>{let o={};for(let u in r){let i=r[u];typeof i=="function"?o[u]=i(...t):h(i)?o[u]=e(i,t):o[u]=i;}return o};return (...r)=>e(n,r)}function se(n,e){let r=(t,o)=>{let u={};for(let i in t)u[i]=t[i](o);return {...o,...u}};return e===void 0?t=>r(n,t):r(n,e)}function ce(n){return Object.keys(n)}function le(n){return Object.values(n)}function fe(n){return Object.entries(n)}function Te(n){return Object.fromEntries(n)}function S(n,e){if(n===e)return true;if(n===null||e===null)return n===e;if(typeof n!=typeof e)return false;if(typeof n=="object"){if(Array.isArray(n)&&Array.isArray(e))return n.length!==e.length?false:n.every((i,a)=>S(i,e[a]));if(Array.isArray(n)||Array.isArray(e))return false;let r=n,t=e,o=Object.keys(r),u=Object.keys(t);return o.length!==u.length?false:o.every(i=>S(r[i],t[i]))}return false}function y(n,e){return e===void 0&&arguments.length===1?r=>S(n,r):S(n,e)}function pe(n,e){return e===void 0&&arguments.length===1?r=>n===r:n===e}function ye(n,e){return e===void 0?r=>r>n:n>e}function me(n,e){return e===void 0?r=>r>=n:n>=e}function xe(n,e){return e===void 0?r=>r<n:n<e}function be(n,e){return e===void 0?r=>r<=n:n<=e}function ge(n){return !n}function Re(n,e){return e===void 0&&arguments.length===1?r=>n&&r:n&&e}function ke(n,e){return e===void 0&&arguments.length===1?r=>n||r:n||e}function Ae(n,e){return e===void 0?r=>t=>n(t)&&r(t):r=>n(r)&&e(r)}function he(n,e){return e===void 0?r=>t=>n(t)||r(t):r=>n(r)||e(r)}function we(n){return e=>!n(e)}function Ue(n){return e=>n.every(r=>r(e))}function Ce(n){return e=>n.some(r=>r(e))}function Se(n,e,r){return t=>n(t)?e(t):r(t)}function Ke(n,e){return r=>n(r)?e(r):r}function Be(n,e){return r=>n(r)?r:e(r)}function Pe(n){return e=>{for(let[r,t]of n)if(r(e))return t(e)}}function ve(n,e){return r=>{try{return n(r)}catch(t){return e(t,r)}}}function Ee(n,e,r){return arguments.length===1?(t,o)=>o===void 0?u=>y(u[n],t):y(o[n],t):r===void 0?t=>y(t[n],e):y(r[n],e)}function Fe(n,e,r){return e===void 0?(t,o)=>o===void 0?u=>n(u[t]):n(o[t]):r===void 0?t=>n(t[e]):n(r[e])}function Ve(n,e,r){return e===void 0&&arguments.length===1?(t,o)=>o===void 0?u=>y(f(n,u),t):y(f(n,o),t):r===void 0?t=>y(f(n,t),e):y(f(n,r),e)}function De(n,e,r){return e===void 0?(t,o)=>o===void 0?u=>n(f(t,u)):n(f(t,o)):r===void 0?t=>n(f(e,t)):n(f(e,r))}function je(n,e){let r=t=>{for(let o in n){let u=n[o];if(u&&!u(t[o]))return false}return true};return e===void 0?r:r(e)}function Ne(n,e){let r=t=>{for(let o in n)if(!y(n[o],t[o]))return false;return true};return e===void 0?r:r(e)}function Oe(n,e){return e===void 0&&arguments.length===1?r=>r==null?false:r instanceof n||r.constructor===n:e==null?false:e instanceof n||e.constructor===n}function Le(n){return n==null}function We(n){return n!=null}function B(n){return n==null?true:typeof n=="string"||Array.isArray(n)?n.length===0:typeof n=="object"?Object.keys(n).length===0:false}function Ie(n){return !B(n)}function _e(n,e){return e===void 0&&arguments.length===1?r=>r==null||typeof r=="number"&&Number.isNaN(r)?n:r:e==null||typeof e=="number"&&Number.isNaN(e)?n:e}function qe(...n){for(let e of n)if(e!=null)return e}function sr(n,e){return e===void 0?r=>n+r:n+e}function cr(n,e){return e===void 0?r=>n-r:n-e}function lr(n,e){return e===void 0?r=>n*r:n*e}function fr(n,e){return e===void 0?r=>n/r:n/e}function Tr(n,e){return e===void 0?r=>n%r:n%e}function pr(n,e){return e===void 0?r=>!Number.isInteger(n)||!Number.isInteger(r)||r<=0?NaN:(n%r+r)%r:!Number.isInteger(n)||!Number.isInteger(e)||e<=0?NaN:(n%e+e)%e}function yr(n){return -n}function mr(n){return n+1}function xr(n){return n-1}function br(n,e,r){return r===void 0?t=>Math.min(e,Math.max(n,t)):Math.min(e,Math.max(n,r))}function gr(n){return Math.abs(n)}function Rr(n){return Math.round(n)}function kr(n){return Math.floor(n)}function Ar(n){return Math.ceil(n)}function hr(n,e){return e===void 0?r=>Math.pow(r,n):Math.pow(e,n)}function wr(n){return n.toUpperCase()}function Ur(n){return n.toLowerCase()}function Cr(n){return n.trim()}function Sr(n,e){return e===void 0?r=>r.split(n):e.split(n)}function Kr(n,e){return e===void 0?r=>r.join(n):e.join(n)}function Br(n,e,r){return r===void 0?t=>t.replace(n,e):r.replace(n,e)}function Pr(n,e){return e===void 0?r=>r.startsWith(n):e.startsWith(n)}function vr(n,e){return e===void 0?r=>r.endsWith(n):e.endsWith(n)}function Er(n,e){return e===void 0?r=>n.test(r):n.test(e)}function Fr(n,e){return e===void 0?r=>r.match(n):e.match(n)}function Vr(n,e,r){return typeof e=="string"?e.substring(n):r===void 0?t=>t.substring(n,e):r.substring(n,e)}function Dr(n,e,r){return typeof e=="string"&&r===void 0&&e.length>1,r===void 0?t=>t.padStart(n,e):r.padStart(n,e)}function jr(n,e,r){return r===void 0?t=>t.padEnd(n,e):r.padEnd(n,e)}function Nr(n,e){return e===void 0?r=>n+r:n+e}function Or(n){return n===null?"null":n===void 0?"undefined":String(n)}function Lr(n){return typeof n=="number"?n:typeof n=="string"?Number(n):typeof n=="boolean"?n?1:0:n==null?NaN:Number(n)}function Wr(n){return !!n}function Ir(n){return Array.isArray(n)?[...n]:n==null?[]:typeof n=="string"?[...n]:typeof n[Symbol.iterator]=="function"?[...n]:[n]}function _r(n){return n==null?{}:typeof n=="object"?n:Object(n)}function qr(n){return n===null?"Null":n===void 0?"Undefined":Object.prototype.toString.call(n).slice(8,-1)}function Me(n,e){return {get:n,set:e}}function ze(n){return {get:e=>e[n],set:(e,r)=>({...r,[n]:e})}}function He(n){return {get:e=>{let r=e;for(let t of n){if(r==null)return;r=r[t];}return r},set:(e,r)=>{if(n.length===0)return e;let t=(o,u,i)=>{let[a,...d]=o,s=typeof a=="number";if(d.length===0){if(Array.isArray(i)){let R=[...i];return R[a]=u,R}return {...i,[a]:u}}if(i==null){let R=s?[]:{};if(s){let P=R;return P[a]=t(d,u,void 0),P}return {[a]:t(d,u,void 0)}}if(Array.isArray(i)){let R=[...i];return R[a]=t(d,u,i[a]),R}let T=i;return {...T,[a]:t(d,u,T[a])}};return t(n,e,r)}}}function $e(n){return {get:e=>e[n],set:(e,r)=>{let t=[...r];return t[n]=e,t}}}function Ye(n,e){return e===void 0?r=>n.get(r):n.get(e)}function Ge(n,e,r){return e===void 0?(t,o)=>o===void 0?u=>n.set(t,u):n.set(t,o):r===void 0?t=>n.set(e,t):n.set(e,r)}function Je(n,e,r){return e===void 0?(t,o)=>o===void 0?u=>n.set(t(n.get(u)),u):n.set(t(n.get(o)),o):r===void 0?t=>n.set(e(n.get(t)),t):n.set(e(n.get(r)),r)}function Qe(n,e){return e===void 0?r=>Promise.all(r.map((t,o)=>n(t,o))):Promise.all(e.map((r,t)=>n(r,t)))}function Xe(n,e){let r=async t=>{let o=[];for(let u=0;u<t.length;u++)o.push(await n(t[u],u));return o};return e===void 0?t=>r(t):r(e)}function Ze(n,e){let r=async t=>(await Promise.all(t.map(async(u,i)=>({item:u,keep:await n(u,i)})))).filter(({keep:u})=>u).map(({item:u})=>u);return e===void 0?t=>r(t):r(e)}function nr(n,e,r){let t=async o=>{let u=e;for(let i=0;i<o.length;i++)u=await n(u,o[i],i);return u};return r===void 0?o=>t(o):t(r)}var b="@@transducer/init",m="@@transducer/step",x="@@transducer/result";function er(n){return e=>({[b]:()=>e[b](),[m]:(r,t)=>e[m](r,n(t)),[x]:r=>e[x](r)})}function rr(n){return e=>({[b]:()=>e[b](),[m]:(r,t)=>n(t)?e[m](r,t):r,[x]:r=>e[x](r)})}function tr(n){return e=>{let r=0;return {[b]:()=>e[b](),[m]:(t,o)=>r<n?(r++,e[m](t,o)):t,[x]:t=>e[x](t)}}}function or(n){return e=>{let r=0;return {[b]:()=>e[b](),[m]:(t,o)=>r<n?(r++,t):e[m](t,o),[x]:t=>e[x](t)}}}function ur(...n){return e=>n.reduceRight((r,t)=>t(r),e)}function Mr(){return {[b]:()=>[],[m]:(n,e)=>(n.push(e),n),[x]:n=>n}}function ir(n,e,r,t){let o=u=>{let i=n(e),a=r;for(let d of u)a=i[m](a,d);return i[x](a)};return t===void 0?u=>o(u):o(t)}function ar(n,e){let r=t=>{let o=n(Mr()),u=o[b]();for(let i of t)u=o[m](u,i);return o[x](u)};return e===void 0?t=>r(t):r(e)}exports.F=V;exports.T=F;exports.__=D;exports.abs=gr;exports.add=sr;exports.allPass=Ue;exports.always=E;exports.and=Re;exports.anyPass=Ce;exports.append=Kn;exports.applySpec=de;exports.assoc=Zn;exports.assocPath=ne;exports.both=Ae;exports.ceil=Ar;exports.chain=Rn;exports.clamp=br;exports.coalesce=qe;exports.complement=we;exports.compose=q;exports.composeAsync=H;exports.composeK=Y;exports.composeT=ur;exports.concat=Sn;exports.concatStr=Nr;exports.cond=Pe;exports.countBy=qn;exports.curry=N;exports.curryN=O;exports.dec=xr;exports.defaultTo=_e;exports.dissoc=ee;exports.dissocPath=re;exports.divide=fr;exports.drop=cn;exports.dropLast=ln;exports.dropT=or;exports.dropWhile=fn;exports.either=he;exports.endsWith=vr;exports.entries=fe;exports.equals=y;exports.every=Vn;exports.evolve=ae;exports.extend=se;exports.filter=Q;exports.filterAsync=Ze;exports.filterT=rr;exports.find=pn;exports.findIndex=yn;exports.findLast=mn;exports.flatten=K;exports.floor=kr;exports.fromEntries=Te;exports.groupBy=Cn;exports.gt=ye;exports.gte=me;exports.head=en;exports.identical=pe;exports.identity=v;exports.ifElse=Se;exports.inc=mr;exports.includes=bn;exports.indexBy=$n;exports.indexOf=xn;exports.init=on;exports.into=ar;exports.is=Oe;exports.isEmpty=B;exports.isNil=Le;exports.isNotEmpty=Ie;exports.isNotNil=We;exports.isPlaceholder=c;exports.join=Kr;exports.keys=ce;exports.last=tn;exports.length=jn;exports.lens=Me;exports.lensIndex=$e;exports.lensPath=He;exports.lensProp=ze;exports.letIn=G;exports.lt=xe;exports.lte=be;exports.map=J;exports.mapAsync=Qe;exports.mapSerial=Xe;exports.mapT=er;exports.match=Fr;exports.mathMod=pr;exports.max=_n;exports.mean=Ln;exports.median=Wn;exports.merge=ue;exports.mergeDeep=ie;exports.min=In;exports.modulo=Tr;exports.multiply=lr;exports.negate=yr;exports.none=Dn;exports.not=ge;exports.nth=un;exports.omit=oe;exports.or=ke;exports.over=Je;exports.padEnd=jr;exports.padStart=Dr;exports.partial=L;exports.partialRight=W;exports.partition=zn;exports.path=f;exports.pathEq=Ve;exports.pathOr=Jn;exports.pathSatisfies=De;exports.pick=te;exports.pipe=I;exports.pipeAsync=z;exports.pipeBuilder=_;exports.pipeK=$;exports.pipeWith=M;exports.pluck=Xn;exports.pow=hr;exports.prepend=Bn;exports.product=On;exports.prop=Yn;exports.propEq=Ee;exports.propOr=Gn;exports.propSatisfies=Fe;exports.props=Qn;exports.range=Mn;exports.reduce=Z;exports.reduceAsync=nr;exports.reduceRight=nn;exports.reject=X;exports.replace=Br;exports.reverse=Un;exports.round=Rr;exports.set=Ge;exports.slice=Tn;exports.some=Fn;exports.sort=hn;exports.sortBy=wn;exports.split=Sr;exports.splitEvery=Hn;exports.startsWith=Pr;exports.substring=Vr;exports.subtract=cr;exports.sum=Nn;exports.tail=rn;exports.take=an;exports.takeLast=dn;exports.takeT=tr;exports.takeWhile=sn;exports.tap=j;exports.test=Er;exports.toArray=Ir;exports.toBoolean=Wr;exports.toLower=Ur;exports.toNumber=Lr;exports.toObject=_r;exports.toString=Or;exports.toUpper=wr;exports.transduce=ir;exports.trim=Cr;exports.tryCatch=ve;exports.type=qr;exports.uniq=kn;exports.uniqBy=An;exports.unless=Be;exports.unnest=gn;exports.values=le;exports.view=Ye;exports.when=Ke;exports.where=je;exports.whereEq=Ne;exports.zip=Pn;exports.zipObj=En;exports.zipWith=vn;
|
|
1
|
+
'use strict';function C(n){return n}function S(n){return function(){return n}}function K(){return true}function B(){return false}var P=Symbol.for("@@statedelta/placeholder"),Ir={[P]:true,__:P};function c(n){return n!==null&&typeof n=="object"&&P in n&&n[P]===true}function y(n){return function e(r){return arguments.length===0?e:n(r)}}function l(n){return function e(r,t){switch(arguments.length){case 0:return e;case 1:return c(r)?e:y(o=>n(r,o));default:return c(r)&&c(t)?e:c(r)?y(o=>n(o,t)):c(t)?y(o=>n(r,o)):n(r,t)}}}var v=l(function(e,r){return e(r),r});function k(n){return function e(r,t,o){switch(arguments.length){case 0:return e;case 1:return c(r)?e:l((s,p)=>n(r,s,p));case 2:return c(r)&&c(t)?e:c(r)?l((s,p)=>n(s,t,p)):c(t)?l((s,p)=>n(r,s,p)):y(s=>n(r,t,s));default:let u=c(r),i=c(t),a=c(o),d=(u?1:0)+(i?1:0)+(a?1:0);return d===3?e:d===2?u?i?l((s,p)=>n(s,p,o)):l((s,p)=>n(s,t,p)):l((s,p)=>n(r,s,p)):d===1?u?y(s=>n(s,t,o)):i?y(s=>n(r,s,o)):y(s=>n(r,t,s)):n(r,t,o)}}}function h(n,e,r){return function t(...o){if(o.length===0)return t;let u=[],i=0;for(let d=0;d<e.length;d++)c(e[d])&&i<o.length?(u.push(o[i]),i++):u.push(e[d]);for(;i<o.length;)u.push(o[i]),i++;let a=0;for(let d=0;d<Math.min(u.length,n);d++)c(u[d])||a++;return a>=n?r.apply(this,u.slice(0,n)):h(n,u,r)}}function E(n){let e=n.length;switch(e){case 0:return n;case 1:return y(n);case 2:return l(n);case 3:return k(n);default:return h(e,[],n)}}function F(n,e){if(n<0)throw new Error(`curryN: arity must be non-negative, got ${n}`);if(n>10)throw new Error(`curryN: arity must be at most 10, got ${n}`);switch(n){case 0:return e;case 1:return y(e);case 2:return l(e);case 3:return k(e);default:return h(n,[],e)}}function V(n,e){return function(...t){let o=[],u=0;for(let i=0;i<e.length;i++)c(e[i])&&u<t.length?(o.push(t[u]),u++):o.push(e[i]);for(;u<t.length;)o.push(t[u]),u++;return n(...o)}}function j(n,e){return function(...t){return n(...t,...e)}}var D=function(e,...r){let t=e;for(let o=0;o<r.length;o++)t=r[o](t);return t},N=function(...e){return e.length===0?r=>r:e.length===1?e[0]:function(t){let o=t;for(let u=0;u<e.length;u++)o=e[u](o);return o}};var O=function(...e){return e.length===0?r=>r:e.length===1?e[0]:function(t){let o=t;for(let u=e.length-1;u>=0;u--)o=e[u](o);return o}};function L(n,e){return e.length===0?(r=>r):function(t){let o=t;for(let u=0;u<e.length;u++)o=n(e[u],o);return o}}function W(...n){return async function(r){let t=r;for(let o=0;o<n.length;o++)t=await n[o](t);return t}}function q(...n){return async function(r){let t=r;for(let o=n.length-1;o>=0;o--)t=await n[o](t);return t}}function I(...n){return e=>r=>n.reduce((t,o)=>o(t)(r),e)}function _(...n){return e=>r=>n.reduceRight((t,o)=>o(t)(r),e)}function _r(n,e){let r={...e};for(let[t,o]of Object.entries(n))r[t]=typeof o=="function"?o(r):o;return r}function M(n,e,r){let t=_r(n,r);return e(t)}function z(n,e,r){return e!==void 0&&r!==void 0?M(n,e,r):e!==void 0?t=>M(n,e,t):(t,o)=>o!==void 0?M(n,t,o):u=>M(n,t,u)}var H=l((n,e)=>{let r=e.length,t=new Array(r);for(let o=0;o<r;o++)t[o]=n(e[o],o,e);return t});var $=l((n,e)=>{let r=[],t=e.length;for(let o=0;o<t;o++)n(e[o],o,e)&&r.push(e[o]);return r}),Y=l((n,e)=>{let r=[],t=e.length;for(let o=0;o<t;o++)n(e[o],o,e)||r.push(e[o]);return r});var G=k((n,e,r)=>{let t=e,o=r.length;for(let u=0;u<o;u++)t=n(t,r[u],u,r);return t}),J=k((n,e,r)=>{let t=e;for(let o=r.length-1;o>=0;o--)t=n(t,r[o],o,r);return t});function Q(n){return n[0]}function X(n){return n.slice(1)}function Z(n){return n[n.length-1]}function nn(n){return n.slice(0,-1)}function en(n,e){if(e===void 0)return t=>{let o=n<0?t.length+n:n;return t[o]};let r=n<0?e.length+n:n;return e[r]}function rn(n,e){return e===void 0?r=>r.slice(0,Math.max(0,n)):e.slice(0,Math.max(0,n))}function tn(n,e){return e===void 0?r=>n<=0?[]:r.slice(-n):n<=0?[]:e.slice(-n)}function on(n,e){let r=t=>{let o=[];for(let u=0;u<t.length&&n(t[u],u,t);u++)o.push(t[u]);return o};return e===void 0?r:r(e)}function un(n,e){return e===void 0?r=>r.slice(Math.max(0,n)):e.slice(Math.max(0,n))}function an(n,e){return e===void 0?r=>n<=0?r.slice():r.slice(0,-n):n<=0?e.slice():e.slice(0,-n)}function dn(n,e){let r=t=>{let o=0;for(;o<t.length&&n(t[o],o,t);)o++;return t.slice(o)};return e===void 0?r:r(e)}function sn(n,e,r){return e!==void 0&&r!==void 0?r.slice(n,e):e!==void 0?t=>t.slice(n,e):function(o,u){return u!==void 0?u.slice(n,o):i=>i.slice(n,o)}}function cn(n,e){let r=t=>{for(let o=0;o<t.length;o++)if(n(t[o],o,t))return t[o]};return e===void 0?r:r(e)}function ln(n,e){let r=t=>{for(let o=0;o<t.length;o++)if(n(t[o],o,t))return o;return -1};return e===void 0?r:r(e)}function fn(n,e){let r=t=>{for(let o=t.length-1;o>=0;o--)if(n(t[o],o,t))return t[o]};return e===void 0?r:r(e)}function pn(n,e){let r=t=>{for(let o=0;o<t.length;o++)if(t[o]===n)return o;return -1};return e===void 0?r:r(e)}function Tn(n,e){let r=t=>{for(let o=0;o<t.length;o++)if(t[o]===n)return true;return false};return e===void 0?r:r(e)}function A(n){let e=[];for(let r=0;r<n.length;r++){let t=n[r];if(Array.isArray(t))for(let o=0;o<t.length;o++)e.push(t[o]);else e.push(t);}return e}var yn=A;function mn(n,e){let r=t=>{let o=[];for(let u=0;u<t.length;u++){let i=n(t[u],u,t);for(let a=0;a<i.length;a++)o.push(i[a]);}return o};return e===void 0?r:r(e)}function xn(n){let e=new Set,r=[];for(let t=0;t<n.length;t++){let o=n[t];e.has(o)||(e.add(o),r.push(o));}return r}function bn(n,e){let r=t=>{let o=new Set,u=[];for(let i=0;i<t.length;i++){let a=t[i],d=n(a);o.has(d)||(o.add(d),u.push(a));}return u};return e===void 0?r:r(e)}function gn(n,e){return e===void 0?r=>[...r].sort(n):[...e].sort(n)}function Rn(n,e){let r=(t,o)=>{let u=n(t),i=n(o);return u<i?-1:u>i?1:0};return e===void 0?t=>[...t].sort(r):[...e].sort(r)}function kn(n){let e=new Array(n.length);for(let r=0;r<n.length;r++)e[n.length-1-r]=n[r];return e}function hn(n,e){let r=t=>{let o={};for(let u=0;u<t.length;u++){let i=t[u],a=n(i);a in o||(o[a]=[]),o[a].push(i);}return o};return e===void 0?r:r(e)}function An(n,e){return e===void 0?r=>[...n,...r]:[...n,...e]}function wn(n,e){return e===void 0?r=>[...r,n]:[...e,n]}function Un(n,e){return e===void 0?r=>[n,...r]:[n,...e]}function Cn(n,e){if(e===void 0)return o=>{let u=Math.min(n.length,o.length),i=new Array(u);for(let a=0;a<u;a++)i[a]=[n[a],o[a]];return i};let r=Math.min(n.length,e.length),t=new Array(r);for(let o=0;o<r;o++)t[o]=[n[o],e[o]];return t}function Sn(n,e,r){if(e!==void 0&&r!==void 0){let t=Math.min(e.length,r.length),o=new Array(t);for(let u=0;u<t;u++)o[u]=n(e[u],r[u]);return o}return e!==void 0?t=>{let o=Math.min(e.length,t.length),u=new Array(o);for(let i=0;i<o;i++)u[i]=n(e[i],t[i]);return u}:function(o,u){if(u!==void 0){let i=Math.min(o.length,u.length),a=new Array(i);for(let d=0;d<i;d++)a[d]=n(o[d],u[d]);return a}return i=>{let a=Math.min(o.length,i.length),d=new Array(a);for(let s=0;s<a;s++)d[s]=n(o[s],i[s]);return d}}}function Kn(n,e){if(e===void 0)return o=>{let u={},i=Math.min(n.length,o.length);for(let a=0;a<i;a++)u[n[a]]=o[a];return u};let r={},t=Math.min(n.length,e.length);for(let o=0;o<t;o++)r[n[o]]=e[o];return r}function Bn(n,e){let r=t=>{for(let o=0;o<t.length;o++)if(n(t[o],o,t))return true;return false};return e===void 0?r:r(e)}function Pn(n,e){let r=t=>{for(let o=0;o<t.length;o++)if(!n(t[o],o,t))return false;return true};return e===void 0?r:r(e)}function vn(n,e){let r=t=>{for(let o=0;o<t.length;o++)if(n(t[o],o,t))return false;return true};return e===void 0?r:r(e)}function En(n){return n.length}function Fn(n){let e=0;for(let r=0;r<n.length;r++)e+=n[r];return e}function Vn(n){if(n.length===0)return 1;let e=1;for(let r=0;r<n.length;r++)e*=n[r];return e}function jn(n){if(n.length===0)return NaN;let e=0;for(let r=0;r<n.length;r++)e+=n[r];return e/n.length}function Dn(n){if(n.length===0)return NaN;let e=[...n].sort((t,o)=>t-o),r=Math.floor(e.length/2);return e.length%2===0?(e[r-1]+e[r])/2:e[r]}function Nn(n){if(n.length===0)return 1/0;let e=n[0];for(let r=1;r<n.length;r++)n[r]<e&&(e=n[r]);return e}function On(n){if(n.length===0)return -1/0;let e=n[0];for(let r=1;r<n.length;r++)n[r]>e&&(e=n[r]);return e}function Ln(n,e){let r=t=>{let o={};for(let u=0;u<t.length;u++){let i=n(t[u]);o[i]=(o[i]||0)+1;}return o};return e===void 0?r:r(e)}function Wn(n,e){if(e===void 0)return t=>{if(n>=t)return [];let o=new Array(t-n);for(let u=0;u<o.length;u++)o[u]=n+u;return o};if(n>=e)return [];let r=new Array(e-n);for(let t=0;t<r.length;t++)r[t]=n+t;return r}function qn(n,e){let r=t=>{let o=[],u=[];for(let i=0;i<t.length;i++)n(t[i],i,t)?o.push(t[i]):u.push(t[i]);return [o,u]};return e===void 0?r:r(e)}function In(n,e){if(e===void 0)return t=>{if(n<=0)return [];let o=[];for(let u=0;u<t.length;u+=n)o.push(t.slice(u,u+n));return o};if(n<=0)return [];let r=[];for(let t=0;t<e.length;t+=n)r.push(e.slice(t,t+n));return r}function _n(n,e){let r=t=>{let o={};for(let u=0;u<t.length;u++){let i=n(t[u]);o[i]=t[u];}return o};return e===void 0?r:r(e)}function Mn(n,e){return e===void 0?r=>r[n]:e[n]}function f(n,e){if(e===void 0)return t=>f(n,t);let r=e;for(let t of n){if(r==null)return;r=r[t];}return r}function zn(n,e,r){if(e===void 0)return (o,u)=>{if(u===void 0)return a=>{let d=a[o];return d??n};let i=u[o];return i??n};if(r===void 0)return o=>{let u=o[e];return u??n};let t=r[e];return t??n}function Hn(n,e,r){if(e===void 0)return (o,u)=>{if(u===void 0)return a=>{let d=f(o,a);return d??n};let i=f(o,u);return i??n};if(r===void 0)return o=>{let u=f(e,o);return u??n};let t=f(e,r);return t??n}function $n(n,e){return e===void 0?r=>n.map(t=>r[t]):n.map(r=>e[r])}function Yn(n,e){return e===void 0?r=>r.map(t=>t[n]):e.map(r=>r[n])}function Jn(n,e,r){return e===void 0?(t,o)=>o===void 0?u=>({...u,[n]:t}):{...o,[n]:t}:r===void 0?t=>({...t,[n]:e}):{...r,[n]:e}}function g(n,e,r){if(n.length===0)return e;let[t,...o]=n,u=typeof t=="number";if(r==null){let a=u?[]:{};if(o.length===0){if(u){let d=a;return d[t]=e,d}return {...a,[t]:e}}if(u){let d=a;return d[t]=g(o,e,void 0),d}return {...a,[t]:g(o,e,void 0)}}if(Array.isArray(r)){let a=[...r];return a[t]=o.length===0?e:g(o,e,r[t]),a}let i=r;return {...i,[t]:o.length===0?e:g(o,e,i[t])}}function Qn(n,e,r){return e===void 0?(t,o)=>o===void 0?u=>g(n,t,u):g(n,t,o):r===void 0?t=>g(n,e,t):g(n,e,r)}function Xn(n,e){if(e===void 0)return o=>{let{[n]:u,...i}=o;return i};let{[n]:r,...t}=e;return t}function Gn(n,e){if(n.length===0||e===null||e===void 0)return e;let[r,...t]=n;if(t.length===0){if(Array.isArray(e)){let a=[...e];return a.splice(r,1),a}let{[r]:u,...i}=e;return i}if(Array.isArray(e)){let u=[...e];return u[r]=Gn(t,e[r]),u}let o=e;return {...o,[r]:Gn(t,o[r])}}function Zn(n,e){return e===void 0?r=>Gn(n,r):Gn(n,e)}function ne(n,e){if(e===void 0)return t=>{let o={};for(let u of n)u in t&&(o[u]=t[u]);return o};let r={};for(let t of n)t in e&&(r[t]=e[t]);return r}function ee(n,e){let r=new Set(n);if(e===void 0)return o=>{let u={};for(let i in o)r.has(i)||(u[i]=o[i]);return u};let t={};for(let o in e)r.has(o)||(t[o]=e[o]);return t}function re(n,e){return e===void 0?r=>({...n,...r}):{...n,...e}}function w(n){return n!==null&&typeof n=="object"&&!Array.isArray(n)}function te(n,e){let r=(t,o)=>{let u={...t};for(let i in o)w(t[i])&&w(o[i])?u[i]=r(t[i],o[i]):u[i]=o[i];return u};return e===void 0?t=>r(n,t):r(n,e)}function oe(n,e){let r=(t,o)=>{let u={...o};for(let i in t)if(i in o){let a=t[i];typeof a=="function"?u[i]=a(o[i]):w(a)&&w(o[i])&&(u[i]=r(a,o[i]));}return u};return e===void 0?t=>r(n,t):r(n,e)}function ue(n){let e=(r,t)=>{let o={};for(let u in r){let i=r[u];typeof i=="function"?o[u]=i(...t):w(i)?o[u]=e(i,t):o[u]=i;}return o};return (...r)=>e(n,r)}function ie(n,e){let r=(t,o)=>{let u={};for(let i in t)u[i]=t[i](o);return {...o,...u}};return e===void 0?t=>r(n,t):r(n,e)}function ae(n){return Object.keys(n)}function de(n){return Object.values(n)}function se(n){return Object.entries(n)}function ce(n){return Object.fromEntries(n)}function le(n,e){if(n===e)return true;if(n===null||e===null)return n===e;if(typeof n!=typeof e)return false;if(typeof n=="object"){if(Array.isArray(n)&&Array.isArray(e))return n.length!==e.length?false:n.every((i,a)=>le(i,e[a]));if(Array.isArray(n)||Array.isArray(e))return false;let r=n,t=e,o=Object.keys(r),u=Object.keys(t);return o.length!==u.length?false:o.every(i=>le(r[i],t[i]))}return false}function T(n,e){return e===void 0&&arguments.length===1?r=>le(n,r):le(n,e)}function fe(n,e){return e===void 0&&arguments.length===1?r=>n===r:n===e}function pe(n,e){return e===void 0?r=>r>n:n>e}function Te(n,e){return e===void 0?r=>r>=n:n>=e}function ye(n,e){return e===void 0?r=>r<n:n<e}function me(n,e){return e===void 0?r=>r<=n:n<=e}function xe(n){return !n}function be(n,e){return e===void 0&&arguments.length===1?r=>n&&r:n&&e}function ge(n,e){return e===void 0&&arguments.length===1?r=>n||r:n||e}function Re(n,e){return e===void 0?r=>t=>n(t)&&r(t):r=>n(r)&&e(r)}function ke(n,e){return e===void 0?r=>t=>n(t)||r(t):r=>n(r)||e(r)}function he(n){return e=>!n(e)}function Ae(n){return e=>n.every(r=>r(e))}function we(n){return e=>n.some(r=>r(e))}function Ue(n,e,r){return t=>n(t)?e(t):r(t)}function Ce(n,e){return r=>n(r)?e(r):r}function Se(n,e){return r=>n(r)?r:e(r)}function Ke(n){return e=>{for(let[r,t]of n)if(r(e))return t(e)}}function Be(n,e){return r=>{try{return n(r)}catch(t){return e(t,r)}}}function Pe(n,e,r){return arguments.length===1?(t,o)=>o===void 0?u=>T(u[n],t):T(o[n],t):r===void 0?t=>T(t[n],e):T(r[n],e)}function ve(n,e,r){return e===void 0?(t,o)=>o===void 0?u=>n(u[t]):n(o[t]):r===void 0?t=>n(t[e]):n(r[e])}function Ee(n,e,r){return e===void 0&&arguments.length===1?(t,o)=>o===void 0?u=>T(f(n,u),t):T(f(n,o),t):r===void 0?t=>T(f(n,t),e):T(f(n,r),e)}function Fe(n,e,r){return e===void 0?(t,o)=>o===void 0?u=>n(f(t,u)):n(f(t,o)):r===void 0?t=>n(f(e,t)):n(f(e,r))}function Ve(n,e){let r=t=>{for(let o in n){let u=n[o];if(u&&!u(t[o]))return false}return true};return e===void 0?r:r(e)}function je(n,e){let r=t=>{for(let o in n)if(!T(n[o],t[o]))return false;return true};return e===void 0?r:r(e)}function De(n,e){return e===void 0&&arguments.length===1?r=>r==null?false:r instanceof n||r.constructor===n:e==null?false:e instanceof n||e.constructor===n}function Ne(n){return n==null}function Oe(n){return n!=null}function U(n){return n==null?true:typeof n=="string"||Array.isArray(n)?n.length===0:typeof n=="object"?Object.keys(n).length===0:false}function Le(n){return !U(n)}function We(n,e){return e===void 0&&arguments.length===1?r=>r==null||typeof r=="number"&&Number.isNaN(r)?n:r:e==null||typeof e=="number"&&Number.isNaN(e)?n:e}function qe(...n){for(let e of n)if(e!=null)return e}function ir(n,e){return e===void 0?r=>n+r:n+e}function ar(n,e){return e===void 0?r=>n-r:n-e}function dr(n,e){return e===void 0?r=>n*r:n*e}function sr(n,e){return e===void 0?r=>n/r:n/e}function cr(n,e){return e===void 0?r=>n%r:n%e}function lr(n,e){return e===void 0?r=>!Number.isInteger(n)||!Number.isInteger(r)||r<=0?NaN:(n%r+r)%r:!Number.isInteger(n)||!Number.isInteger(e)||e<=0?NaN:(n%e+e)%e}function fr(n){return -n}function pr(n){return n+1}function Tr(n){return n-1}function yr(n,e,r){return r===void 0?t=>Math.min(e,Math.max(n,t)):Math.min(e,Math.max(n,r))}function mr(n){return Math.abs(n)}function xr(n){return Math.round(n)}function br(n){return Math.floor(n)}function gr(n){return Math.ceil(n)}function Rr(n,e){return e===void 0?r=>Math.pow(r,n):Math.pow(e,n)}function kr(n){return n.toUpperCase()}function hr(n){return n.toLowerCase()}function Ar(n){return n.trim()}function wr(n,e){return e===void 0?r=>r.split(n):e.split(n)}function Ur(n,e){return e===void 0?r=>r.join(n):e.join(n)}function Cr(n,e,r){return r===void 0?t=>t.replace(n,e):r.replace(n,e)}function Sr(n,e){return e===void 0?r=>r.startsWith(n):e.startsWith(n)}function Kr(n,e){return e===void 0?r=>r.endsWith(n):e.endsWith(n)}function Br(n,e){return e===void 0?r=>n.test(r):n.test(e)}function Pr(n,e){return e===void 0?r=>r.match(n):e.match(n)}function vr(n,e,r){return typeof e=="string"?e.substring(n):r===void 0?t=>t.substring(n,e):r.substring(n,e)}function Er(n,e,r){return typeof e=="string"&&r===void 0&&e.length>1,r===void 0?t=>t.padStart(n,e):r.padStart(n,e)}function Fr(n,e,r){return r===void 0?t=>t.padEnd(n,e):r.padEnd(n,e)}function Vr(n,e){return e===void 0?r=>n+r:n+e}function jr(n){return n===null?"null":n===void 0?"undefined":String(n)}function Dr(n){return typeof n=="number"?n:typeof n=="string"?Number(n):typeof n=="boolean"?n?1:0:n==null?NaN:Number(n)}function Nr(n){return !!n}function Or(n){return Array.isArray(n)?[...n]:n==null?[]:typeof n=="string"?[...n]:typeof n[Symbol.iterator]=="function"?[...n]:[n]}function Lr(n){return n==null?{}:typeof n=="object"?n:Object(n)}function Wr(n){return n===null?"Null":n===void 0?"Undefined":Object.prototype.toString.call(n).slice(8,-1)}function Ie(n,e){return {get:n,set:e}}function _e(n){return {get:e=>e[n],set:(e,r)=>({...r,[n]:e})}}function Me(n){return {get:e=>{let r=e;for(let t of n){if(r==null)return;r=r[t];}return r},set:(e,r)=>{if(n.length===0)return e;let t=(o,u,i)=>{let[a,...d]=o,s=typeof a=="number";if(d.length===0){if(Array.isArray(i)){let R=[...i];return R[a]=u,R}return {...i,[a]:u}}if(i==null){let R=s?[]:{};if(s){let qr=R;return qr[a]=t(d,u,void 0),qr}return {[a]:t(d,u,void 0)}}if(Array.isArray(i)){let R=[...i];return R[a]=t(d,u,i[a]),R}let p=i;return {...p,[a]:t(d,u,p[a])}};return t(n,e,r)}}}function ze(n){return {get:e=>e[n],set:(e,r)=>{let t=[...r];return t[n]=e,t}}}function He(n,e){return e===void 0?r=>n.get(r):n.get(e)}function $e(n,e,r){return e===void 0?(t,o)=>o===void 0?u=>n.set(t,u):n.set(t,o):r===void 0?t=>n.set(e,t):n.set(e,r)}function Ye(n,e,r){return e===void 0?(t,o)=>o===void 0?u=>n.set(t(n.get(u)),u):n.set(t(n.get(o)),o):r===void 0?t=>n.set(e(n.get(t)),t):n.set(e(n.get(r)),r)}function Ge(n,e){return e===void 0?r=>Promise.all(r.map((t,o)=>n(t,o))):Promise.all(e.map((r,t)=>n(r,t)))}function Je(n,e){let r=async t=>{let o=[];for(let u=0;u<t.length;u++)o.push(await n(t[u],u));return o};return e===void 0?t=>r(t):r(e)}function Qe(n,e){let r=async t=>(await Promise.all(t.map(async(u,i)=>({item:u,keep:await n(u,i)})))).filter(({keep:u})=>u).map(({item:u})=>u);return e===void 0?t=>r(t):r(e)}function Xe(n,e,r){let t=async o=>{let u=e;for(let i=0;i<o.length;i++)u=await n(u,o[i],i);return u};return r===void 0?o=>t(o):t(r)}var b="@@transducer/init",m="@@transducer/step",x="@@transducer/result";function Ze(n){return e=>({[b]:()=>e[b](),[m]:(r,t)=>e[m](r,n(t)),[x]:r=>e[x](r)})}function nr(n){return e=>({[b]:()=>e[b](),[m]:(r,t)=>n(t)?e[m](r,t):r,[x]:r=>e[x](r)})}function er(n){return e=>{let r=0;return {[b]:()=>e[b](),[m]:(t,o)=>r<n?(r++,e[m](t,o)):t,[x]:t=>e[x](t)}}}function rr(n){return e=>{let r=0;return {[b]:()=>e[b](),[m]:(t,o)=>r<n?(r++,t):e[m](t,o),[x]:t=>e[x](t)}}}function tr(...n){return e=>n.reduceRight((r,t)=>t(r),e)}function Mr(){return {[b]:()=>[],[m]:(n,e)=>(n.push(e),n),[x]:n=>n}}function or(n,e,r,t){let o=u=>{let i=n(e),a=r;for(let d of u)a=i[m](a,d);return i[x](a)};return t===void 0?u=>o(u):o(t)}function ur(n,e){let r=t=>{let o=n(Mr()),u=o[b]();for(let i of t)u=o[m](u,i);return o[x](u)};return e===void 0?t=>r(t):r(e)}var Go={identity:C,always:S,T:K,F:B,tap:v,curry:E,curryN:F,partial:V,partialRight:j,pipe:D,pipeBuilder:N,compose:O,pipeWith:L,pipeAsync:W,composeAsync:q,pipeK:I,composeK:_,letIn:z,map:H,filter:$,reject:Y,reduce:G,reduceRight:J,head:Q,tail:X,last:Z,init:nn,nth:en,take:rn,takeLast:tn,takeWhile:on,drop:un,dropLast:an,dropWhile:dn,slice:sn,find:cn,findIndex:ln,findLast:fn,indexOf:pn,includes:Tn,flatten:A,unnest:yn,chain:mn,uniq:xn,uniqBy:bn,sort:gn,sortBy:Rn,reverse:kn,groupBy:hn,concat:An,append:wn,prepend:Un,zip:Cn,zipWith:Sn,zipObj:Kn,some:Bn,every:Pn,none:vn,length:En,sum:Fn,product:Vn,mean:jn,median:Dn,min:Nn,max:On,countBy:Ln,range:Wn,partition:qn,splitEvery:In,indexBy:_n,prop:Mn,path:f,propOr:zn,pathOr:Hn,props:$n,pluck:Yn,assoc:Jn,assocPath:Qn,dissoc:Xn,dissocPath:Zn,pick:ne,omit:ee,merge:re,mergeDeep:te,evolve:oe,applySpec:ue,extend:ie,keys:ae,values:de,entries:se,fromEntries:ce,equals:T,identical:fe,gt:pe,gte:Te,lt:ye,lte:me,not:xe,and:be,or:ge,both:Re,either:ke,complement:he,allPass:Ae,anyPass:we,ifElse:Ue,when:Ce,unless:Se,cond:Ke,tryCatch:Be,propEq:Pe,propSatisfies:ve,pathEq:Ee,pathSatisfies:Fe,where:Ve,whereEq:je,is:De,isNil:Ne,isEmpty:U,isNotNil:Oe,isNotEmpty:Le,defaultTo:We,coalesce:qe,add:ir,subtract:ar,multiply:dr,divide:sr,modulo:cr,mathMod:lr,negate:fr,inc:pr,dec:Tr,clamp:yr,abs:mr,round:xr,floor:br,ceil:gr,pow:Rr,toUpper:kr,toLower:hr,trim:Ar,split:wr,join:Ur,replace:Cr,startsWith:Sr,endsWith:Kr,test:Br,match:Pr,substring:vr,padStart:Er,padEnd:Fr,concatStr:Vr,toString:jr,toNumber:Dr,toBoolean:Nr,toArray:Or,toObject:Lr,type:Wr,lens:Ie,lensProp:_e,lensPath:Me,lensIndex:ze,view:He,set:$e,over:Ye,mapAsync:Ge,mapSerial:Je,filterAsync:Qe,reduceAsync:Xe,mapT:Ze,filterT:nr,takeT:er,dropT:rr,composeT:tr,transduce:or,into:ur};exports.F=B;exports.T=K;exports.__=Ir;exports.abs=mr;exports.add=ir;exports.allPass=Ae;exports.always=S;exports.and=be;exports.anyPass=we;exports.append=wn;exports.applySpec=ue;exports.assoc=Jn;exports.assocPath=Qn;exports.both=Re;exports.ceil=gr;exports.chain=mn;exports.clamp=yr;exports.coalesce=qe;exports.complement=he;exports.compose=O;exports.composeAsync=q;exports.composeK=_;exports.composeT=tr;exports.concat=An;exports.concatStr=Vr;exports.cond=Ke;exports.countBy=Ln;exports.curry=E;exports.curryN=F;exports.dec=Tr;exports.defaultTo=We;exports.dissoc=Xn;exports.dissocPath=Zn;exports.divide=sr;exports.drop=un;exports.dropLast=an;exports.dropT=rr;exports.dropWhile=dn;exports.either=ke;exports.endsWith=Kr;exports.entries=se;exports.equals=T;exports.every=Pn;exports.evolve=oe;exports.extend=ie;exports.filter=$;exports.filterAsync=Qe;exports.filterT=nr;exports.find=cn;exports.findIndex=ln;exports.findLast=fn;exports.flatten=A;exports.floor=br;exports.fromEntries=ce;exports.groupBy=hn;exports.gt=pe;exports.gte=Te;exports.head=Q;exports.identical=fe;exports.identity=C;exports.ifElse=Ue;exports.inc=pr;exports.includes=Tn;exports.indexBy=_n;exports.indexOf=pn;exports.init=nn;exports.into=ur;exports.is=De;exports.isEmpty=U;exports.isNil=Ne;exports.isNotEmpty=Le;exports.isNotNil=Oe;exports.isPlaceholder=c;exports.join=Ur;exports.keys=ae;exports.last=Z;exports.length=En;exports.lens=Ie;exports.lensIndex=ze;exports.lensPath=Me;exports.lensProp=_e;exports.letIn=z;exports.lt=ye;exports.lte=me;exports.map=H;exports.mapAsync=Ge;exports.mapSerial=Je;exports.mapT=Ze;exports.match=Pr;exports.mathMod=lr;exports.max=On;exports.mean=jn;exports.median=Dn;exports.merge=re;exports.mergeDeep=te;exports.min=Nn;exports.modulo=cr;exports.multiply=dr;exports.negate=fr;exports.none=vn;exports.not=xe;exports.nth=en;exports.omit=ee;exports.or=ge;exports.over=Ye;exports.padEnd=Fr;exports.padStart=Er;exports.partial=V;exports.partialRight=j;exports.partition=qn;exports.path=f;exports.pathEq=Ee;exports.pathOr=Hn;exports.pathSatisfies=Fe;exports.pick=ne;exports.pipe=D;exports.pipeAsync=W;exports.pipeBuilder=N;exports.pipeK=I;exports.pipeWith=L;exports.pluck=Yn;exports.pow=Rr;exports.prepend=Un;exports.product=Vn;exports.prop=Mn;exports.propEq=Pe;exports.propOr=zn;exports.propSatisfies=ve;exports.props=$n;exports.range=Wn;exports.reduce=G;exports.reduceAsync=Xe;exports.reduceRight=J;exports.reject=Y;exports.replace=Cr;exports.reverse=kn;exports.round=xr;exports.scope=Go;exports.set=$e;exports.slice=sn;exports.some=Bn;exports.sort=gn;exports.sortBy=Rn;exports.split=wr;exports.splitEvery=In;exports.startsWith=Sr;exports.substring=vr;exports.subtract=ar;exports.sum=Fn;exports.tail=X;exports.take=rn;exports.takeLast=tn;exports.takeT=er;exports.takeWhile=on;exports.tap=v;exports.test=Br;exports.toArray=Or;exports.toBoolean=Nr;exports.toLower=hr;exports.toNumber=Dr;exports.toObject=Lr;exports.toString=jr;exports.toUpper=kr;exports.transduce=or;exports.trim=Ar;exports.tryCatch=Be;exports.type=Wr;exports.uniq=xn;exports.uniqBy=bn;exports.unless=Se;exports.unnest=yn;exports.values=de;exports.view=He;exports.when=Ce;exports.where=Ve;exports.whereEq=je;exports.zip=Cn;exports.zipObj=Kn;exports.zipWith=Sn;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,152 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns its argument unchanged.
|
|
3
|
-
*
|
|
4
|
-
* The identity function is useful as a default transformation,
|
|
5
|
-
* placeholder in pipelines, or when a function is required but
|
|
6
|
-
* no transformation is needed.
|
|
7
|
-
*
|
|
8
|
-
* @param x - The value to return
|
|
9
|
-
* @returns The same value
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```ts
|
|
13
|
-
* identity(5); // 5
|
|
14
|
-
* identity({ a: 1 }); // { a: 1 }
|
|
15
|
-
* identity([1, 2, 3]); // [1, 2, 3]
|
|
16
|
-
*
|
|
17
|
-
* // Useful as default in pipelines
|
|
18
|
-
* const transform = condition ? someTransform : identity;
|
|
19
|
-
* pipe(data, transform, process);
|
|
20
|
-
*
|
|
21
|
-
* // Useful as filter predicate (keeps truthy values)
|
|
22
|
-
* [1, 0, 2, null, 3].filter(identity); // [1, 2, 3]
|
|
23
|
-
* ```
|
|
24
|
-
*/
|
|
25
|
-
declare function identity<T>(x: T): T;
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Creates a function that always returns the same value.
|
|
29
|
-
*
|
|
30
|
-
* Useful for providing constant values in places that expect functions,
|
|
31
|
-
* like in `cond`, `ifElse`, or as default transformations.
|
|
32
|
-
*
|
|
33
|
-
* @param x - The value to always return
|
|
34
|
-
* @returns A function that ignores its arguments and returns x
|
|
35
|
-
*
|
|
36
|
-
* @example
|
|
37
|
-
* ```ts
|
|
38
|
-
* const alwaysFive = always(5);
|
|
39
|
-
* alwaysFive(); // 5
|
|
40
|
-
* alwaysFive(100); // 5
|
|
41
|
-
* alwaysFive('any'); // 5
|
|
42
|
-
*
|
|
43
|
-
* // Useful in conditionals
|
|
44
|
-
* const getDiscount = cond([
|
|
45
|
-
* [propEq('tier', 'gold'), always(0.3)],
|
|
46
|
-
* [propEq('tier', 'silver'), always(0.2)],
|
|
47
|
-
* [T, always(0)] // default
|
|
48
|
-
* ]);
|
|
49
|
-
*
|
|
50
|
-
* // Useful in ifElse
|
|
51
|
-
* const discount = ifElse(
|
|
52
|
-
* propEq('vip', true),
|
|
53
|
-
* always(0.2),
|
|
54
|
-
* always(0)
|
|
55
|
-
* );
|
|
56
|
-
* ```
|
|
57
|
-
*/
|
|
58
|
-
declare function always<T>(x: T): () => T;
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Constant functions that return true or false.
|
|
62
|
-
*
|
|
63
|
-
* These are useful as default predicates in conditional functions
|
|
64
|
-
* like `cond`, `filter`, or as terminal cases in pattern matching.
|
|
65
|
-
*/
|
|
66
|
-
/**
|
|
67
|
-
* A function that always returns true.
|
|
68
|
-
*
|
|
69
|
-
* Useful as a default case or catch-all predicate.
|
|
70
|
-
*
|
|
71
|
-
* @returns Always true
|
|
72
|
-
*
|
|
73
|
-
* @example
|
|
74
|
-
* ```ts
|
|
75
|
-
* T(); // true
|
|
76
|
-
*
|
|
77
|
-
* // Default case in cond
|
|
78
|
-
* const classify = cond([
|
|
79
|
-
* [propEq('type', 'admin'), always('full')],
|
|
80
|
-
* [propEq('type', 'user'), always('limited')],
|
|
81
|
-
* [T, always('none')] // default case - always matches
|
|
82
|
-
* ]);
|
|
83
|
-
*
|
|
84
|
-
* // Always include
|
|
85
|
-
* filter(T, [1, 2, 3]); // [1, 2, 3]
|
|
86
|
-
* ```
|
|
87
|
-
*/
|
|
88
|
-
declare function T$1(): true;
|
|
89
|
-
/**
|
|
90
|
-
* A function that always returns false.
|
|
91
|
-
*
|
|
92
|
-
* Useful as a never-matching predicate or to explicitly exclude.
|
|
93
|
-
*
|
|
94
|
-
* @returns Always false
|
|
95
|
-
*
|
|
96
|
-
* @example
|
|
97
|
-
* ```ts
|
|
98
|
-
* F(); // false
|
|
99
|
-
*
|
|
100
|
-
* // Never match
|
|
101
|
-
* filter(F, [1, 2, 3]); // []
|
|
102
|
-
*
|
|
103
|
-
* // Explicit disable
|
|
104
|
-
* const shouldProcess = isEnabled ? checkCondition : F;
|
|
105
|
-
* ```
|
|
106
|
-
*/
|
|
107
|
-
declare function F(): false;
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Executes a side-effect function and returns the original value.
|
|
111
|
-
*
|
|
112
|
-
* `tap` is invaluable for debugging pipelines, logging intermediate
|
|
113
|
-
* values, or performing side-effects without breaking the data flow.
|
|
114
|
-
* The side-effect function's return value is ignored.
|
|
115
|
-
*
|
|
116
|
-
* @param fn - The side-effect function to execute
|
|
117
|
-
* @param x - The value to pass through
|
|
118
|
-
* @returns The original value x, unchanged
|
|
119
|
-
*
|
|
120
|
-
* @example
|
|
121
|
-
* ```ts
|
|
122
|
-
* // Debugging a pipeline
|
|
123
|
-
* pipe(
|
|
124
|
-
* [1, 2, 3, 4, 5],
|
|
125
|
-
* filter(x => x > 2),
|
|
126
|
-
* tap(console.log), // logs: [3, 4, 5]
|
|
127
|
-
* map(x => x * 2),
|
|
128
|
-
* tap(console.log), // logs: [6, 8, 10]
|
|
129
|
-
* sum
|
|
130
|
-
* ); // 24
|
|
131
|
-
*
|
|
132
|
-
* // Curried usage
|
|
133
|
-
* const log = tap(console.log);
|
|
134
|
-
* log('hello'); // logs 'hello', returns 'hello'
|
|
135
|
-
*
|
|
136
|
-
* // Side-effects in transformations
|
|
137
|
-
* const users = pipe(
|
|
138
|
-
* fetchUsers(),
|
|
139
|
-
* tap(users => analytics.track('users_fetched', { count: users.length })),
|
|
140
|
-
* filter(user => user.active)
|
|
141
|
-
* );
|
|
142
|
-
* ```
|
|
143
|
-
*/
|
|
144
|
-
interface TapFn {
|
|
145
|
-
<T>(fn: (x: T) => void, x: T): T;
|
|
146
|
-
<T>(fn: (x: T) => void): (x: T) => T;
|
|
147
|
-
}
|
|
148
|
-
declare const tap: TapFn;
|
|
149
|
-
|
|
150
1
|
/**
|
|
151
2
|
* @statedelta-libs/operators - Type Definitions
|
|
152
3
|
*
|
|
@@ -353,6 +204,155 @@ type Reducer<T, U> = (accumulator: U, value: T, index: number, array: readonly T
|
|
|
353
204
|
*/
|
|
354
205
|
type Comparator<T> = (a: T, b: T) => number;
|
|
355
206
|
|
|
207
|
+
/**
|
|
208
|
+
* Executes a side-effect function and returns the original value.
|
|
209
|
+
*
|
|
210
|
+
* `tap` is invaluable for debugging pipelines, logging intermediate
|
|
211
|
+
* values, or performing side-effects without breaking the data flow.
|
|
212
|
+
* The side-effect function's return value is ignored.
|
|
213
|
+
*
|
|
214
|
+
* @param fn - The side-effect function to execute
|
|
215
|
+
* @param x - The value to pass through
|
|
216
|
+
* @returns The original value x, unchanged
|
|
217
|
+
*
|
|
218
|
+
* @example
|
|
219
|
+
* ```ts
|
|
220
|
+
* // Debugging a pipeline
|
|
221
|
+
* pipe(
|
|
222
|
+
* [1, 2, 3, 4, 5],
|
|
223
|
+
* filter(x => x > 2),
|
|
224
|
+
* tap(console.log), // logs: [3, 4, 5]
|
|
225
|
+
* map(x => x * 2),
|
|
226
|
+
* tap(console.log), // logs: [6, 8, 10]
|
|
227
|
+
* sum
|
|
228
|
+
* ); // 24
|
|
229
|
+
*
|
|
230
|
+
* // Curried usage
|
|
231
|
+
* const log = tap(console.log);
|
|
232
|
+
* log('hello'); // logs 'hello', returns 'hello'
|
|
233
|
+
*
|
|
234
|
+
* // Side-effects in transformations
|
|
235
|
+
* const users = pipe(
|
|
236
|
+
* fetchUsers(),
|
|
237
|
+
* tap(users => analytics.track('users_fetched', { count: users.length })),
|
|
238
|
+
* filter(user => user.active)
|
|
239
|
+
* );
|
|
240
|
+
* ```
|
|
241
|
+
*/
|
|
242
|
+
interface TapFn {
|
|
243
|
+
<T>(fn: (x: T) => void, x: T): T;
|
|
244
|
+
<T>(fn: (x: T) => void): (x: T) => T;
|
|
245
|
+
}
|
|
246
|
+
declare const tap: TapFn;
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* Returns its argument unchanged.
|
|
250
|
+
*
|
|
251
|
+
* The identity function is useful as a default transformation,
|
|
252
|
+
* placeholder in pipelines, or when a function is required but
|
|
253
|
+
* no transformation is needed.
|
|
254
|
+
*
|
|
255
|
+
* @param x - The value to return
|
|
256
|
+
* @returns The same value
|
|
257
|
+
*
|
|
258
|
+
* @example
|
|
259
|
+
* ```ts
|
|
260
|
+
* identity(5); // 5
|
|
261
|
+
* identity({ a: 1 }); // { a: 1 }
|
|
262
|
+
* identity([1, 2, 3]); // [1, 2, 3]
|
|
263
|
+
*
|
|
264
|
+
* // Useful as default in pipelines
|
|
265
|
+
* const transform = condition ? someTransform : identity;
|
|
266
|
+
* pipe(data, transform, process);
|
|
267
|
+
*
|
|
268
|
+
* // Useful as filter predicate (keeps truthy values)
|
|
269
|
+
* [1, 0, 2, null, 3].filter(identity); // [1, 2, 3]
|
|
270
|
+
* ```
|
|
271
|
+
*/
|
|
272
|
+
declare function identity<T>(x: T): T;
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* Creates a function that always returns the same value.
|
|
276
|
+
*
|
|
277
|
+
* Useful for providing constant values in places that expect functions,
|
|
278
|
+
* like in `cond`, `ifElse`, or as default transformations.
|
|
279
|
+
*
|
|
280
|
+
* @param x - The value to always return
|
|
281
|
+
* @returns A function that ignores its arguments and returns x
|
|
282
|
+
*
|
|
283
|
+
* @example
|
|
284
|
+
* ```ts
|
|
285
|
+
* const alwaysFive = always(5);
|
|
286
|
+
* alwaysFive(); // 5
|
|
287
|
+
* alwaysFive(100); // 5
|
|
288
|
+
* alwaysFive('any'); // 5
|
|
289
|
+
*
|
|
290
|
+
* // Useful in conditionals
|
|
291
|
+
* const getDiscount = cond([
|
|
292
|
+
* [propEq('tier', 'gold'), always(0.3)],
|
|
293
|
+
* [propEq('tier', 'silver'), always(0.2)],
|
|
294
|
+
* [T, always(0)] // default
|
|
295
|
+
* ]);
|
|
296
|
+
*
|
|
297
|
+
* // Useful in ifElse
|
|
298
|
+
* const discount = ifElse(
|
|
299
|
+
* propEq('vip', true),
|
|
300
|
+
* always(0.2),
|
|
301
|
+
* always(0)
|
|
302
|
+
* );
|
|
303
|
+
* ```
|
|
304
|
+
*/
|
|
305
|
+
declare function always<T>(x: T): () => T;
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* Constant functions that return true or false.
|
|
309
|
+
*
|
|
310
|
+
* These are useful as default predicates in conditional functions
|
|
311
|
+
* like `cond`, `filter`, or as terminal cases in pattern matching.
|
|
312
|
+
*/
|
|
313
|
+
/**
|
|
314
|
+
* A function that always returns true.
|
|
315
|
+
*
|
|
316
|
+
* Useful as a default case or catch-all predicate.
|
|
317
|
+
*
|
|
318
|
+
* @returns Always true
|
|
319
|
+
*
|
|
320
|
+
* @example
|
|
321
|
+
* ```ts
|
|
322
|
+
* T(); // true
|
|
323
|
+
*
|
|
324
|
+
* // Default case in cond
|
|
325
|
+
* const classify = cond([
|
|
326
|
+
* [propEq('type', 'admin'), always('full')],
|
|
327
|
+
* [propEq('type', 'user'), always('limited')],
|
|
328
|
+
* [T, always('none')] // default case - always matches
|
|
329
|
+
* ]);
|
|
330
|
+
*
|
|
331
|
+
* // Always include
|
|
332
|
+
* filter(T, [1, 2, 3]); // [1, 2, 3]
|
|
333
|
+
* ```
|
|
334
|
+
*/
|
|
335
|
+
declare function T$1(): true;
|
|
336
|
+
/**
|
|
337
|
+
* A function that always returns false.
|
|
338
|
+
*
|
|
339
|
+
* Useful as a never-matching predicate or to explicitly exclude.
|
|
340
|
+
*
|
|
341
|
+
* @returns Always false
|
|
342
|
+
*
|
|
343
|
+
* @example
|
|
344
|
+
* ```ts
|
|
345
|
+
* F(); // false
|
|
346
|
+
*
|
|
347
|
+
* // Never match
|
|
348
|
+
* filter(F, [1, 2, 3]); // []
|
|
349
|
+
*
|
|
350
|
+
* // Explicit disable
|
|
351
|
+
* const shouldProcess = isEnabled ? checkCondition : F;
|
|
352
|
+
* ```
|
|
353
|
+
*/
|
|
354
|
+
declare function F(): false;
|
|
355
|
+
|
|
356
356
|
/**
|
|
357
357
|
* Transforms a function into a curried version.
|
|
358
358
|
*
|
|
@@ -2352,4 +2352,208 @@ declare function transduce<A, B, Acc>(transducer: Transducer<A, B>, transformer:
|
|
|
2352
2352
|
declare function into<A, B>(transducer: Transducer<A, B>): (collection: readonly A[]) => B[];
|
|
2353
2353
|
declare function into<A, B>(transducer: Transducer<A, B>, collection: readonly A[]): B[];
|
|
2354
2354
|
|
|
2355
|
-
|
|
2355
|
+
declare const scope: {
|
|
2356
|
+
readonly identity: typeof identity;
|
|
2357
|
+
readonly always: typeof always;
|
|
2358
|
+
readonly T: typeof T$1;
|
|
2359
|
+
readonly F: typeof F;
|
|
2360
|
+
readonly tap: TapFn;
|
|
2361
|
+
readonly curry: typeof curry;
|
|
2362
|
+
readonly curryN: typeof curryN;
|
|
2363
|
+
readonly partial: typeof partial;
|
|
2364
|
+
readonly partialRight: typeof partialRight;
|
|
2365
|
+
readonly pipe: PipeFn;
|
|
2366
|
+
readonly pipeBuilder: PipeBuilderFn;
|
|
2367
|
+
readonly compose: ComposeBuilderFn;
|
|
2368
|
+
readonly pipeWith: typeof pipeWith;
|
|
2369
|
+
readonly pipeAsync: typeof pipeAsync;
|
|
2370
|
+
readonly composeAsync: typeof composeAsync;
|
|
2371
|
+
readonly pipeK: typeof pipeK;
|
|
2372
|
+
readonly composeK: typeof composeK;
|
|
2373
|
+
readonly letIn: typeof letIn;
|
|
2374
|
+
readonly map: {
|
|
2375
|
+
<T, U>(fn: (value: T, index: number, array: readonly T[]) => U, arr: readonly T[]): U[];
|
|
2376
|
+
<T, U>(fn: (value: T, index: number, array: readonly T[]) => U): (arr: readonly T[]) => U[];
|
|
2377
|
+
};
|
|
2378
|
+
readonly filter: {
|
|
2379
|
+
<T, S extends T>(pred: (value: T, index: number, array: readonly T[]) => value is S, arr: readonly T[]): S[];
|
|
2380
|
+
<T>(pred: (value: T, index: number, array: readonly T[]) => boolean, arr: readonly T[]): T[];
|
|
2381
|
+
<T, S extends T>(pred: (value: T, index: number, array: readonly T[]) => value is S): (arr: readonly T[]) => S[];
|
|
2382
|
+
<T>(pred: (value: T, index: number, array: readonly T[]) => boolean): (arr: readonly T[]) => T[];
|
|
2383
|
+
};
|
|
2384
|
+
readonly reject: {
|
|
2385
|
+
<T>(pred: (value: T, index: number, array: readonly T[]) => boolean, arr: readonly T[]): T[];
|
|
2386
|
+
<T>(pred: (value: T, index: number, array: readonly T[]) => boolean): (arr: readonly T[]) => T[];
|
|
2387
|
+
};
|
|
2388
|
+
readonly reduce: {
|
|
2389
|
+
<T, U>(fn: (accumulator: U, value: T, index: number, array: readonly T[]) => U, init: U, arr: readonly T[]): U;
|
|
2390
|
+
<T, U>(fn: (accumulator: U, value: T, index: number, array: readonly T[]) => U, init: U): (arr: readonly T[]) => U;
|
|
2391
|
+
<T, U>(fn: (accumulator: U, value: T, index: number, array: readonly T[]) => U): {
|
|
2392
|
+
(init: U, arr: readonly T[]): U;
|
|
2393
|
+
(init: U): (arr: readonly T[]) => U;
|
|
2394
|
+
};
|
|
2395
|
+
};
|
|
2396
|
+
readonly reduceRight: {
|
|
2397
|
+
<T, U>(fn: (accumulator: U, value: T, index: number, array: readonly T[]) => U, init: U, arr: readonly T[]): U;
|
|
2398
|
+
<T, U>(fn: (accumulator: U, value: T, index: number, array: readonly T[]) => U, init: U): (arr: readonly T[]) => U;
|
|
2399
|
+
<T, U>(fn: (accumulator: U, value: T, index: number, array: readonly T[]) => U): {
|
|
2400
|
+
(init: U, arr: readonly T[]): U;
|
|
2401
|
+
(init: U): (arr: readonly T[]) => U;
|
|
2402
|
+
};
|
|
2403
|
+
};
|
|
2404
|
+
readonly head: typeof head;
|
|
2405
|
+
readonly tail: typeof tail;
|
|
2406
|
+
readonly last: typeof last;
|
|
2407
|
+
readonly init: typeof init;
|
|
2408
|
+
readonly nth: typeof nth;
|
|
2409
|
+
readonly take: typeof take;
|
|
2410
|
+
readonly takeLast: typeof takeLast;
|
|
2411
|
+
readonly takeWhile: typeof takeWhile;
|
|
2412
|
+
readonly drop: typeof drop;
|
|
2413
|
+
readonly dropLast: typeof dropLast;
|
|
2414
|
+
readonly dropWhile: typeof dropWhile;
|
|
2415
|
+
readonly slice: typeof slice;
|
|
2416
|
+
readonly find: typeof find;
|
|
2417
|
+
readonly findIndex: typeof findIndex;
|
|
2418
|
+
readonly findLast: typeof findLast;
|
|
2419
|
+
readonly indexOf: typeof indexOf;
|
|
2420
|
+
readonly includes: typeof includes;
|
|
2421
|
+
readonly flatten: typeof flatten;
|
|
2422
|
+
readonly unnest: typeof flatten;
|
|
2423
|
+
readonly chain: typeof chain;
|
|
2424
|
+
readonly uniq: typeof uniq;
|
|
2425
|
+
readonly uniqBy: typeof uniqBy;
|
|
2426
|
+
readonly sort: typeof sort;
|
|
2427
|
+
readonly sortBy: typeof sortBy;
|
|
2428
|
+
readonly reverse: typeof reverse;
|
|
2429
|
+
readonly groupBy: typeof groupBy;
|
|
2430
|
+
readonly concat: typeof concat;
|
|
2431
|
+
readonly append: typeof append;
|
|
2432
|
+
readonly prepend: typeof prepend;
|
|
2433
|
+
readonly zip: typeof zip;
|
|
2434
|
+
readonly zipWith: typeof zipWith;
|
|
2435
|
+
readonly zipObj: typeof zipObj;
|
|
2436
|
+
readonly some: typeof some;
|
|
2437
|
+
readonly every: typeof every;
|
|
2438
|
+
readonly none: typeof none;
|
|
2439
|
+
readonly length: typeof length;
|
|
2440
|
+
readonly sum: typeof sum;
|
|
2441
|
+
readonly product: typeof product;
|
|
2442
|
+
readonly mean: typeof mean;
|
|
2443
|
+
readonly median: typeof median;
|
|
2444
|
+
readonly min: typeof min;
|
|
2445
|
+
readonly max: typeof max;
|
|
2446
|
+
readonly countBy: typeof countBy;
|
|
2447
|
+
readonly range: typeof range;
|
|
2448
|
+
readonly partition: typeof partition;
|
|
2449
|
+
readonly splitEvery: typeof splitEvery;
|
|
2450
|
+
readonly indexBy: typeof indexBy;
|
|
2451
|
+
readonly prop: typeof prop;
|
|
2452
|
+
readonly path: typeof path;
|
|
2453
|
+
readonly propOr: typeof propOr;
|
|
2454
|
+
readonly pathOr: typeof pathOr;
|
|
2455
|
+
readonly props: typeof props;
|
|
2456
|
+
readonly pluck: typeof pluck;
|
|
2457
|
+
readonly assoc: typeof assoc;
|
|
2458
|
+
readonly assocPath: typeof assocPath;
|
|
2459
|
+
readonly dissoc: typeof dissoc;
|
|
2460
|
+
readonly dissocPath: typeof dissocPath;
|
|
2461
|
+
readonly pick: typeof pick;
|
|
2462
|
+
readonly omit: typeof omit;
|
|
2463
|
+
readonly merge: typeof merge;
|
|
2464
|
+
readonly mergeDeep: typeof mergeDeep;
|
|
2465
|
+
readonly evolve: typeof evolve;
|
|
2466
|
+
readonly applySpec: typeof applySpec;
|
|
2467
|
+
readonly extend: typeof extend;
|
|
2468
|
+
readonly keys: typeof keys;
|
|
2469
|
+
readonly values: typeof values;
|
|
2470
|
+
readonly entries: typeof entries;
|
|
2471
|
+
readonly fromEntries: typeof fromEntries;
|
|
2472
|
+
readonly equals: typeof equals;
|
|
2473
|
+
readonly identical: typeof identical;
|
|
2474
|
+
readonly gt: typeof gt;
|
|
2475
|
+
readonly gte: typeof gte;
|
|
2476
|
+
readonly lt: typeof lt;
|
|
2477
|
+
readonly lte: typeof lte;
|
|
2478
|
+
readonly not: typeof not;
|
|
2479
|
+
readonly and: typeof and;
|
|
2480
|
+
readonly or: typeof or;
|
|
2481
|
+
readonly both: typeof both;
|
|
2482
|
+
readonly either: typeof either;
|
|
2483
|
+
readonly complement: typeof complement;
|
|
2484
|
+
readonly allPass: typeof allPass;
|
|
2485
|
+
readonly anyPass: typeof anyPass;
|
|
2486
|
+
readonly ifElse: typeof ifElse;
|
|
2487
|
+
readonly when: typeof when;
|
|
2488
|
+
readonly unless: typeof unless;
|
|
2489
|
+
readonly cond: typeof cond;
|
|
2490
|
+
readonly tryCatch: typeof tryCatch;
|
|
2491
|
+
readonly propEq: typeof propEq;
|
|
2492
|
+
readonly propSatisfies: typeof propSatisfies;
|
|
2493
|
+
readonly pathEq: typeof pathEq;
|
|
2494
|
+
readonly pathSatisfies: typeof pathSatisfies;
|
|
2495
|
+
readonly where: typeof where;
|
|
2496
|
+
readonly whereEq: typeof whereEq;
|
|
2497
|
+
readonly is: typeof is;
|
|
2498
|
+
readonly isNil: typeof isNil;
|
|
2499
|
+
readonly isEmpty: typeof isEmpty;
|
|
2500
|
+
readonly isNotNil: typeof isNotNil;
|
|
2501
|
+
readonly isNotEmpty: typeof isNotEmpty;
|
|
2502
|
+
readonly defaultTo: typeof defaultTo;
|
|
2503
|
+
readonly coalesce: typeof coalesce;
|
|
2504
|
+
readonly add: typeof add;
|
|
2505
|
+
readonly subtract: typeof subtract;
|
|
2506
|
+
readonly multiply: typeof multiply;
|
|
2507
|
+
readonly divide: typeof divide;
|
|
2508
|
+
readonly modulo: typeof modulo;
|
|
2509
|
+
readonly mathMod: typeof mathMod;
|
|
2510
|
+
readonly negate: typeof negate;
|
|
2511
|
+
readonly inc: typeof inc;
|
|
2512
|
+
readonly dec: typeof dec;
|
|
2513
|
+
readonly clamp: typeof clamp;
|
|
2514
|
+
readonly abs: typeof abs;
|
|
2515
|
+
readonly round: typeof round;
|
|
2516
|
+
readonly floor: typeof floor;
|
|
2517
|
+
readonly ceil: typeof ceil;
|
|
2518
|
+
readonly pow: typeof pow;
|
|
2519
|
+
readonly toUpper: typeof toUpper;
|
|
2520
|
+
readonly toLower: typeof toLower;
|
|
2521
|
+
readonly trim: typeof trim;
|
|
2522
|
+
readonly split: typeof split;
|
|
2523
|
+
readonly join: typeof join;
|
|
2524
|
+
readonly replace: typeof replace;
|
|
2525
|
+
readonly startsWith: typeof startsWith;
|
|
2526
|
+
readonly endsWith: typeof endsWith;
|
|
2527
|
+
readonly test: typeof test;
|
|
2528
|
+
readonly match: typeof match;
|
|
2529
|
+
readonly substring: typeof substring;
|
|
2530
|
+
readonly padStart: typeof padStart;
|
|
2531
|
+
readonly padEnd: typeof padEnd;
|
|
2532
|
+
readonly concatStr: typeof concatStr;
|
|
2533
|
+
readonly toString: typeof toString;
|
|
2534
|
+
readonly toNumber: typeof toNumber;
|
|
2535
|
+
readonly toBoolean: typeof toBoolean;
|
|
2536
|
+
readonly toArray: typeof toArray;
|
|
2537
|
+
readonly toObject: typeof toObject;
|
|
2538
|
+
readonly type: typeof type;
|
|
2539
|
+
readonly lens: typeof lens;
|
|
2540
|
+
readonly lensProp: typeof lensProp;
|
|
2541
|
+
readonly lensPath: typeof lensPath;
|
|
2542
|
+
readonly lensIndex: typeof lensIndex;
|
|
2543
|
+
readonly view: typeof view;
|
|
2544
|
+
readonly set: typeof set;
|
|
2545
|
+
readonly over: typeof over;
|
|
2546
|
+
readonly mapAsync: typeof mapAsync;
|
|
2547
|
+
readonly mapSerial: typeof mapSerial;
|
|
2548
|
+
readonly filterAsync: typeof filterAsync;
|
|
2549
|
+
readonly reduceAsync: typeof reduceAsync;
|
|
2550
|
+
readonly mapT: typeof mapT;
|
|
2551
|
+
readonly filterT: typeof filterT;
|
|
2552
|
+
readonly takeT: typeof takeT;
|
|
2553
|
+
readonly dropT: typeof dropT;
|
|
2554
|
+
readonly composeT: typeof composeT;
|
|
2555
|
+
readonly transduce: typeof transduce;
|
|
2556
|
+
readonly into: typeof into;
|
|
2557
|
+
};
|
|
2558
|
+
|
|
2559
|
+
export { type BinaryFn, type Comparator, type ComposeBuilderFn, type Curry1, type Curry2, type Curry3, type DeepReadonly, F, type Fn, type Head, type Last, type Lens, type Mapper, type Nullable, type ParamsOf, type PipeBuilderFn, type PipeFn, type PipeTransformer, type Placeholder, type Predicate, type Reducer, type ReturnOf, T$1 as T, type Tail, type TapFn, type TernaryFn, type Transducer, type Transformer, type UnaryFn, type VariadicFn, placeholder as __, abs, add, allPass, always, and, anyPass, append, applySpec, assoc, assocPath, both, ceil, chain, clamp, coalesce, complement, compose, composeAsync, composeK, composeT, concat, concatStr, cond, countBy, curry, curryN, dec, defaultTo, dissoc, dissocPath, divide, drop, dropLast, dropT, dropWhile, either, endsWith, entries, equals, every, evolve, extend, filter, filterAsync, filterT, find, findIndex, findLast, flatten, floor, fromEntries, groupBy, gt, gte, head, identical, identity, ifElse, inc, includes, indexBy, indexOf, init, into, is, isEmpty, isNil, isNotEmpty, isNotNil, isPlaceholder, join, keys, last, length, lens, lensIndex, lensPath, lensProp, letIn, lt, lte, map, mapAsync, mapSerial, mapT, match, mathMod, max, mean, median, merge, mergeDeep, min, modulo, multiply, negate, none, not, nth, omit, or, over, padEnd, padStart, partial, partialRight, partition, path, pathEq, pathOr, pathSatisfies, pick, pipe, pipeAsync, pipeBuilder, pipeK, pipeWith, pluck, pow, prepend, product, prop, propEq, propOr, propSatisfies, props, range, reduce, reduceAsync, reduceRight, reject, replace, reverse, round, scope, set, slice, some, sort, sortBy, split, splitEvery, startsWith, substring, subtract, sum, tail, take, takeLast, takeT, takeWhile, tap, test, toArray, toBoolean, toLower, toNumber, toObject, toString, toUpper, transduce, trim, tryCatch, type, uniq, uniqBy, unless, unnest, values, view, when, where, whereEq, zip, zipObj, zipWith };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,152 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns its argument unchanged.
|
|
3
|
-
*
|
|
4
|
-
* The identity function is useful as a default transformation,
|
|
5
|
-
* placeholder in pipelines, or when a function is required but
|
|
6
|
-
* no transformation is needed.
|
|
7
|
-
*
|
|
8
|
-
* @param x - The value to return
|
|
9
|
-
* @returns The same value
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```ts
|
|
13
|
-
* identity(5); // 5
|
|
14
|
-
* identity({ a: 1 }); // { a: 1 }
|
|
15
|
-
* identity([1, 2, 3]); // [1, 2, 3]
|
|
16
|
-
*
|
|
17
|
-
* // Useful as default in pipelines
|
|
18
|
-
* const transform = condition ? someTransform : identity;
|
|
19
|
-
* pipe(data, transform, process);
|
|
20
|
-
*
|
|
21
|
-
* // Useful as filter predicate (keeps truthy values)
|
|
22
|
-
* [1, 0, 2, null, 3].filter(identity); // [1, 2, 3]
|
|
23
|
-
* ```
|
|
24
|
-
*/
|
|
25
|
-
declare function identity<T>(x: T): T;
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Creates a function that always returns the same value.
|
|
29
|
-
*
|
|
30
|
-
* Useful for providing constant values in places that expect functions,
|
|
31
|
-
* like in `cond`, `ifElse`, or as default transformations.
|
|
32
|
-
*
|
|
33
|
-
* @param x - The value to always return
|
|
34
|
-
* @returns A function that ignores its arguments and returns x
|
|
35
|
-
*
|
|
36
|
-
* @example
|
|
37
|
-
* ```ts
|
|
38
|
-
* const alwaysFive = always(5);
|
|
39
|
-
* alwaysFive(); // 5
|
|
40
|
-
* alwaysFive(100); // 5
|
|
41
|
-
* alwaysFive('any'); // 5
|
|
42
|
-
*
|
|
43
|
-
* // Useful in conditionals
|
|
44
|
-
* const getDiscount = cond([
|
|
45
|
-
* [propEq('tier', 'gold'), always(0.3)],
|
|
46
|
-
* [propEq('tier', 'silver'), always(0.2)],
|
|
47
|
-
* [T, always(0)] // default
|
|
48
|
-
* ]);
|
|
49
|
-
*
|
|
50
|
-
* // Useful in ifElse
|
|
51
|
-
* const discount = ifElse(
|
|
52
|
-
* propEq('vip', true),
|
|
53
|
-
* always(0.2),
|
|
54
|
-
* always(0)
|
|
55
|
-
* );
|
|
56
|
-
* ```
|
|
57
|
-
*/
|
|
58
|
-
declare function always<T>(x: T): () => T;
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Constant functions that return true or false.
|
|
62
|
-
*
|
|
63
|
-
* These are useful as default predicates in conditional functions
|
|
64
|
-
* like `cond`, `filter`, or as terminal cases in pattern matching.
|
|
65
|
-
*/
|
|
66
|
-
/**
|
|
67
|
-
* A function that always returns true.
|
|
68
|
-
*
|
|
69
|
-
* Useful as a default case or catch-all predicate.
|
|
70
|
-
*
|
|
71
|
-
* @returns Always true
|
|
72
|
-
*
|
|
73
|
-
* @example
|
|
74
|
-
* ```ts
|
|
75
|
-
* T(); // true
|
|
76
|
-
*
|
|
77
|
-
* // Default case in cond
|
|
78
|
-
* const classify = cond([
|
|
79
|
-
* [propEq('type', 'admin'), always('full')],
|
|
80
|
-
* [propEq('type', 'user'), always('limited')],
|
|
81
|
-
* [T, always('none')] // default case - always matches
|
|
82
|
-
* ]);
|
|
83
|
-
*
|
|
84
|
-
* // Always include
|
|
85
|
-
* filter(T, [1, 2, 3]); // [1, 2, 3]
|
|
86
|
-
* ```
|
|
87
|
-
*/
|
|
88
|
-
declare function T$1(): true;
|
|
89
|
-
/**
|
|
90
|
-
* A function that always returns false.
|
|
91
|
-
*
|
|
92
|
-
* Useful as a never-matching predicate or to explicitly exclude.
|
|
93
|
-
*
|
|
94
|
-
* @returns Always false
|
|
95
|
-
*
|
|
96
|
-
* @example
|
|
97
|
-
* ```ts
|
|
98
|
-
* F(); // false
|
|
99
|
-
*
|
|
100
|
-
* // Never match
|
|
101
|
-
* filter(F, [1, 2, 3]); // []
|
|
102
|
-
*
|
|
103
|
-
* // Explicit disable
|
|
104
|
-
* const shouldProcess = isEnabled ? checkCondition : F;
|
|
105
|
-
* ```
|
|
106
|
-
*/
|
|
107
|
-
declare function F(): false;
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Executes a side-effect function and returns the original value.
|
|
111
|
-
*
|
|
112
|
-
* `tap` is invaluable for debugging pipelines, logging intermediate
|
|
113
|
-
* values, or performing side-effects without breaking the data flow.
|
|
114
|
-
* The side-effect function's return value is ignored.
|
|
115
|
-
*
|
|
116
|
-
* @param fn - The side-effect function to execute
|
|
117
|
-
* @param x - The value to pass through
|
|
118
|
-
* @returns The original value x, unchanged
|
|
119
|
-
*
|
|
120
|
-
* @example
|
|
121
|
-
* ```ts
|
|
122
|
-
* // Debugging a pipeline
|
|
123
|
-
* pipe(
|
|
124
|
-
* [1, 2, 3, 4, 5],
|
|
125
|
-
* filter(x => x > 2),
|
|
126
|
-
* tap(console.log), // logs: [3, 4, 5]
|
|
127
|
-
* map(x => x * 2),
|
|
128
|
-
* tap(console.log), // logs: [6, 8, 10]
|
|
129
|
-
* sum
|
|
130
|
-
* ); // 24
|
|
131
|
-
*
|
|
132
|
-
* // Curried usage
|
|
133
|
-
* const log = tap(console.log);
|
|
134
|
-
* log('hello'); // logs 'hello', returns 'hello'
|
|
135
|
-
*
|
|
136
|
-
* // Side-effects in transformations
|
|
137
|
-
* const users = pipe(
|
|
138
|
-
* fetchUsers(),
|
|
139
|
-
* tap(users => analytics.track('users_fetched', { count: users.length })),
|
|
140
|
-
* filter(user => user.active)
|
|
141
|
-
* );
|
|
142
|
-
* ```
|
|
143
|
-
*/
|
|
144
|
-
interface TapFn {
|
|
145
|
-
<T>(fn: (x: T) => void, x: T): T;
|
|
146
|
-
<T>(fn: (x: T) => void): (x: T) => T;
|
|
147
|
-
}
|
|
148
|
-
declare const tap: TapFn;
|
|
149
|
-
|
|
150
1
|
/**
|
|
151
2
|
* @statedelta-libs/operators - Type Definitions
|
|
152
3
|
*
|
|
@@ -353,6 +204,155 @@ type Reducer<T, U> = (accumulator: U, value: T, index: number, array: readonly T
|
|
|
353
204
|
*/
|
|
354
205
|
type Comparator<T> = (a: T, b: T) => number;
|
|
355
206
|
|
|
207
|
+
/**
|
|
208
|
+
* Executes a side-effect function and returns the original value.
|
|
209
|
+
*
|
|
210
|
+
* `tap` is invaluable for debugging pipelines, logging intermediate
|
|
211
|
+
* values, or performing side-effects without breaking the data flow.
|
|
212
|
+
* The side-effect function's return value is ignored.
|
|
213
|
+
*
|
|
214
|
+
* @param fn - The side-effect function to execute
|
|
215
|
+
* @param x - The value to pass through
|
|
216
|
+
* @returns The original value x, unchanged
|
|
217
|
+
*
|
|
218
|
+
* @example
|
|
219
|
+
* ```ts
|
|
220
|
+
* // Debugging a pipeline
|
|
221
|
+
* pipe(
|
|
222
|
+
* [1, 2, 3, 4, 5],
|
|
223
|
+
* filter(x => x > 2),
|
|
224
|
+
* tap(console.log), // logs: [3, 4, 5]
|
|
225
|
+
* map(x => x * 2),
|
|
226
|
+
* tap(console.log), // logs: [6, 8, 10]
|
|
227
|
+
* sum
|
|
228
|
+
* ); // 24
|
|
229
|
+
*
|
|
230
|
+
* // Curried usage
|
|
231
|
+
* const log = tap(console.log);
|
|
232
|
+
* log('hello'); // logs 'hello', returns 'hello'
|
|
233
|
+
*
|
|
234
|
+
* // Side-effects in transformations
|
|
235
|
+
* const users = pipe(
|
|
236
|
+
* fetchUsers(),
|
|
237
|
+
* tap(users => analytics.track('users_fetched', { count: users.length })),
|
|
238
|
+
* filter(user => user.active)
|
|
239
|
+
* );
|
|
240
|
+
* ```
|
|
241
|
+
*/
|
|
242
|
+
interface TapFn {
|
|
243
|
+
<T>(fn: (x: T) => void, x: T): T;
|
|
244
|
+
<T>(fn: (x: T) => void): (x: T) => T;
|
|
245
|
+
}
|
|
246
|
+
declare const tap: TapFn;
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* Returns its argument unchanged.
|
|
250
|
+
*
|
|
251
|
+
* The identity function is useful as a default transformation,
|
|
252
|
+
* placeholder in pipelines, or when a function is required but
|
|
253
|
+
* no transformation is needed.
|
|
254
|
+
*
|
|
255
|
+
* @param x - The value to return
|
|
256
|
+
* @returns The same value
|
|
257
|
+
*
|
|
258
|
+
* @example
|
|
259
|
+
* ```ts
|
|
260
|
+
* identity(5); // 5
|
|
261
|
+
* identity({ a: 1 }); // { a: 1 }
|
|
262
|
+
* identity([1, 2, 3]); // [1, 2, 3]
|
|
263
|
+
*
|
|
264
|
+
* // Useful as default in pipelines
|
|
265
|
+
* const transform = condition ? someTransform : identity;
|
|
266
|
+
* pipe(data, transform, process);
|
|
267
|
+
*
|
|
268
|
+
* // Useful as filter predicate (keeps truthy values)
|
|
269
|
+
* [1, 0, 2, null, 3].filter(identity); // [1, 2, 3]
|
|
270
|
+
* ```
|
|
271
|
+
*/
|
|
272
|
+
declare function identity<T>(x: T): T;
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* Creates a function that always returns the same value.
|
|
276
|
+
*
|
|
277
|
+
* Useful for providing constant values in places that expect functions,
|
|
278
|
+
* like in `cond`, `ifElse`, or as default transformations.
|
|
279
|
+
*
|
|
280
|
+
* @param x - The value to always return
|
|
281
|
+
* @returns A function that ignores its arguments and returns x
|
|
282
|
+
*
|
|
283
|
+
* @example
|
|
284
|
+
* ```ts
|
|
285
|
+
* const alwaysFive = always(5);
|
|
286
|
+
* alwaysFive(); // 5
|
|
287
|
+
* alwaysFive(100); // 5
|
|
288
|
+
* alwaysFive('any'); // 5
|
|
289
|
+
*
|
|
290
|
+
* // Useful in conditionals
|
|
291
|
+
* const getDiscount = cond([
|
|
292
|
+
* [propEq('tier', 'gold'), always(0.3)],
|
|
293
|
+
* [propEq('tier', 'silver'), always(0.2)],
|
|
294
|
+
* [T, always(0)] // default
|
|
295
|
+
* ]);
|
|
296
|
+
*
|
|
297
|
+
* // Useful in ifElse
|
|
298
|
+
* const discount = ifElse(
|
|
299
|
+
* propEq('vip', true),
|
|
300
|
+
* always(0.2),
|
|
301
|
+
* always(0)
|
|
302
|
+
* );
|
|
303
|
+
* ```
|
|
304
|
+
*/
|
|
305
|
+
declare function always<T>(x: T): () => T;
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* Constant functions that return true or false.
|
|
309
|
+
*
|
|
310
|
+
* These are useful as default predicates in conditional functions
|
|
311
|
+
* like `cond`, `filter`, or as terminal cases in pattern matching.
|
|
312
|
+
*/
|
|
313
|
+
/**
|
|
314
|
+
* A function that always returns true.
|
|
315
|
+
*
|
|
316
|
+
* Useful as a default case or catch-all predicate.
|
|
317
|
+
*
|
|
318
|
+
* @returns Always true
|
|
319
|
+
*
|
|
320
|
+
* @example
|
|
321
|
+
* ```ts
|
|
322
|
+
* T(); // true
|
|
323
|
+
*
|
|
324
|
+
* // Default case in cond
|
|
325
|
+
* const classify = cond([
|
|
326
|
+
* [propEq('type', 'admin'), always('full')],
|
|
327
|
+
* [propEq('type', 'user'), always('limited')],
|
|
328
|
+
* [T, always('none')] // default case - always matches
|
|
329
|
+
* ]);
|
|
330
|
+
*
|
|
331
|
+
* // Always include
|
|
332
|
+
* filter(T, [1, 2, 3]); // [1, 2, 3]
|
|
333
|
+
* ```
|
|
334
|
+
*/
|
|
335
|
+
declare function T$1(): true;
|
|
336
|
+
/**
|
|
337
|
+
* A function that always returns false.
|
|
338
|
+
*
|
|
339
|
+
* Useful as a never-matching predicate or to explicitly exclude.
|
|
340
|
+
*
|
|
341
|
+
* @returns Always false
|
|
342
|
+
*
|
|
343
|
+
* @example
|
|
344
|
+
* ```ts
|
|
345
|
+
* F(); // false
|
|
346
|
+
*
|
|
347
|
+
* // Never match
|
|
348
|
+
* filter(F, [1, 2, 3]); // []
|
|
349
|
+
*
|
|
350
|
+
* // Explicit disable
|
|
351
|
+
* const shouldProcess = isEnabled ? checkCondition : F;
|
|
352
|
+
* ```
|
|
353
|
+
*/
|
|
354
|
+
declare function F(): false;
|
|
355
|
+
|
|
356
356
|
/**
|
|
357
357
|
* Transforms a function into a curried version.
|
|
358
358
|
*
|
|
@@ -2352,4 +2352,208 @@ declare function transduce<A, B, Acc>(transducer: Transducer<A, B>, transformer:
|
|
|
2352
2352
|
declare function into<A, B>(transducer: Transducer<A, B>): (collection: readonly A[]) => B[];
|
|
2353
2353
|
declare function into<A, B>(transducer: Transducer<A, B>, collection: readonly A[]): B[];
|
|
2354
2354
|
|
|
2355
|
-
|
|
2355
|
+
declare const scope: {
|
|
2356
|
+
readonly identity: typeof identity;
|
|
2357
|
+
readonly always: typeof always;
|
|
2358
|
+
readonly T: typeof T$1;
|
|
2359
|
+
readonly F: typeof F;
|
|
2360
|
+
readonly tap: TapFn;
|
|
2361
|
+
readonly curry: typeof curry;
|
|
2362
|
+
readonly curryN: typeof curryN;
|
|
2363
|
+
readonly partial: typeof partial;
|
|
2364
|
+
readonly partialRight: typeof partialRight;
|
|
2365
|
+
readonly pipe: PipeFn;
|
|
2366
|
+
readonly pipeBuilder: PipeBuilderFn;
|
|
2367
|
+
readonly compose: ComposeBuilderFn;
|
|
2368
|
+
readonly pipeWith: typeof pipeWith;
|
|
2369
|
+
readonly pipeAsync: typeof pipeAsync;
|
|
2370
|
+
readonly composeAsync: typeof composeAsync;
|
|
2371
|
+
readonly pipeK: typeof pipeK;
|
|
2372
|
+
readonly composeK: typeof composeK;
|
|
2373
|
+
readonly letIn: typeof letIn;
|
|
2374
|
+
readonly map: {
|
|
2375
|
+
<T, U>(fn: (value: T, index: number, array: readonly T[]) => U, arr: readonly T[]): U[];
|
|
2376
|
+
<T, U>(fn: (value: T, index: number, array: readonly T[]) => U): (arr: readonly T[]) => U[];
|
|
2377
|
+
};
|
|
2378
|
+
readonly filter: {
|
|
2379
|
+
<T, S extends T>(pred: (value: T, index: number, array: readonly T[]) => value is S, arr: readonly T[]): S[];
|
|
2380
|
+
<T>(pred: (value: T, index: number, array: readonly T[]) => boolean, arr: readonly T[]): T[];
|
|
2381
|
+
<T, S extends T>(pred: (value: T, index: number, array: readonly T[]) => value is S): (arr: readonly T[]) => S[];
|
|
2382
|
+
<T>(pred: (value: T, index: number, array: readonly T[]) => boolean): (arr: readonly T[]) => T[];
|
|
2383
|
+
};
|
|
2384
|
+
readonly reject: {
|
|
2385
|
+
<T>(pred: (value: T, index: number, array: readonly T[]) => boolean, arr: readonly T[]): T[];
|
|
2386
|
+
<T>(pred: (value: T, index: number, array: readonly T[]) => boolean): (arr: readonly T[]) => T[];
|
|
2387
|
+
};
|
|
2388
|
+
readonly reduce: {
|
|
2389
|
+
<T, U>(fn: (accumulator: U, value: T, index: number, array: readonly T[]) => U, init: U, arr: readonly T[]): U;
|
|
2390
|
+
<T, U>(fn: (accumulator: U, value: T, index: number, array: readonly T[]) => U, init: U): (arr: readonly T[]) => U;
|
|
2391
|
+
<T, U>(fn: (accumulator: U, value: T, index: number, array: readonly T[]) => U): {
|
|
2392
|
+
(init: U, arr: readonly T[]): U;
|
|
2393
|
+
(init: U): (arr: readonly T[]) => U;
|
|
2394
|
+
};
|
|
2395
|
+
};
|
|
2396
|
+
readonly reduceRight: {
|
|
2397
|
+
<T, U>(fn: (accumulator: U, value: T, index: number, array: readonly T[]) => U, init: U, arr: readonly T[]): U;
|
|
2398
|
+
<T, U>(fn: (accumulator: U, value: T, index: number, array: readonly T[]) => U, init: U): (arr: readonly T[]) => U;
|
|
2399
|
+
<T, U>(fn: (accumulator: U, value: T, index: number, array: readonly T[]) => U): {
|
|
2400
|
+
(init: U, arr: readonly T[]): U;
|
|
2401
|
+
(init: U): (arr: readonly T[]) => U;
|
|
2402
|
+
};
|
|
2403
|
+
};
|
|
2404
|
+
readonly head: typeof head;
|
|
2405
|
+
readonly tail: typeof tail;
|
|
2406
|
+
readonly last: typeof last;
|
|
2407
|
+
readonly init: typeof init;
|
|
2408
|
+
readonly nth: typeof nth;
|
|
2409
|
+
readonly take: typeof take;
|
|
2410
|
+
readonly takeLast: typeof takeLast;
|
|
2411
|
+
readonly takeWhile: typeof takeWhile;
|
|
2412
|
+
readonly drop: typeof drop;
|
|
2413
|
+
readonly dropLast: typeof dropLast;
|
|
2414
|
+
readonly dropWhile: typeof dropWhile;
|
|
2415
|
+
readonly slice: typeof slice;
|
|
2416
|
+
readonly find: typeof find;
|
|
2417
|
+
readonly findIndex: typeof findIndex;
|
|
2418
|
+
readonly findLast: typeof findLast;
|
|
2419
|
+
readonly indexOf: typeof indexOf;
|
|
2420
|
+
readonly includes: typeof includes;
|
|
2421
|
+
readonly flatten: typeof flatten;
|
|
2422
|
+
readonly unnest: typeof flatten;
|
|
2423
|
+
readonly chain: typeof chain;
|
|
2424
|
+
readonly uniq: typeof uniq;
|
|
2425
|
+
readonly uniqBy: typeof uniqBy;
|
|
2426
|
+
readonly sort: typeof sort;
|
|
2427
|
+
readonly sortBy: typeof sortBy;
|
|
2428
|
+
readonly reverse: typeof reverse;
|
|
2429
|
+
readonly groupBy: typeof groupBy;
|
|
2430
|
+
readonly concat: typeof concat;
|
|
2431
|
+
readonly append: typeof append;
|
|
2432
|
+
readonly prepend: typeof prepend;
|
|
2433
|
+
readonly zip: typeof zip;
|
|
2434
|
+
readonly zipWith: typeof zipWith;
|
|
2435
|
+
readonly zipObj: typeof zipObj;
|
|
2436
|
+
readonly some: typeof some;
|
|
2437
|
+
readonly every: typeof every;
|
|
2438
|
+
readonly none: typeof none;
|
|
2439
|
+
readonly length: typeof length;
|
|
2440
|
+
readonly sum: typeof sum;
|
|
2441
|
+
readonly product: typeof product;
|
|
2442
|
+
readonly mean: typeof mean;
|
|
2443
|
+
readonly median: typeof median;
|
|
2444
|
+
readonly min: typeof min;
|
|
2445
|
+
readonly max: typeof max;
|
|
2446
|
+
readonly countBy: typeof countBy;
|
|
2447
|
+
readonly range: typeof range;
|
|
2448
|
+
readonly partition: typeof partition;
|
|
2449
|
+
readonly splitEvery: typeof splitEvery;
|
|
2450
|
+
readonly indexBy: typeof indexBy;
|
|
2451
|
+
readonly prop: typeof prop;
|
|
2452
|
+
readonly path: typeof path;
|
|
2453
|
+
readonly propOr: typeof propOr;
|
|
2454
|
+
readonly pathOr: typeof pathOr;
|
|
2455
|
+
readonly props: typeof props;
|
|
2456
|
+
readonly pluck: typeof pluck;
|
|
2457
|
+
readonly assoc: typeof assoc;
|
|
2458
|
+
readonly assocPath: typeof assocPath;
|
|
2459
|
+
readonly dissoc: typeof dissoc;
|
|
2460
|
+
readonly dissocPath: typeof dissocPath;
|
|
2461
|
+
readonly pick: typeof pick;
|
|
2462
|
+
readonly omit: typeof omit;
|
|
2463
|
+
readonly merge: typeof merge;
|
|
2464
|
+
readonly mergeDeep: typeof mergeDeep;
|
|
2465
|
+
readonly evolve: typeof evolve;
|
|
2466
|
+
readonly applySpec: typeof applySpec;
|
|
2467
|
+
readonly extend: typeof extend;
|
|
2468
|
+
readonly keys: typeof keys;
|
|
2469
|
+
readonly values: typeof values;
|
|
2470
|
+
readonly entries: typeof entries;
|
|
2471
|
+
readonly fromEntries: typeof fromEntries;
|
|
2472
|
+
readonly equals: typeof equals;
|
|
2473
|
+
readonly identical: typeof identical;
|
|
2474
|
+
readonly gt: typeof gt;
|
|
2475
|
+
readonly gte: typeof gte;
|
|
2476
|
+
readonly lt: typeof lt;
|
|
2477
|
+
readonly lte: typeof lte;
|
|
2478
|
+
readonly not: typeof not;
|
|
2479
|
+
readonly and: typeof and;
|
|
2480
|
+
readonly or: typeof or;
|
|
2481
|
+
readonly both: typeof both;
|
|
2482
|
+
readonly either: typeof either;
|
|
2483
|
+
readonly complement: typeof complement;
|
|
2484
|
+
readonly allPass: typeof allPass;
|
|
2485
|
+
readonly anyPass: typeof anyPass;
|
|
2486
|
+
readonly ifElse: typeof ifElse;
|
|
2487
|
+
readonly when: typeof when;
|
|
2488
|
+
readonly unless: typeof unless;
|
|
2489
|
+
readonly cond: typeof cond;
|
|
2490
|
+
readonly tryCatch: typeof tryCatch;
|
|
2491
|
+
readonly propEq: typeof propEq;
|
|
2492
|
+
readonly propSatisfies: typeof propSatisfies;
|
|
2493
|
+
readonly pathEq: typeof pathEq;
|
|
2494
|
+
readonly pathSatisfies: typeof pathSatisfies;
|
|
2495
|
+
readonly where: typeof where;
|
|
2496
|
+
readonly whereEq: typeof whereEq;
|
|
2497
|
+
readonly is: typeof is;
|
|
2498
|
+
readonly isNil: typeof isNil;
|
|
2499
|
+
readonly isEmpty: typeof isEmpty;
|
|
2500
|
+
readonly isNotNil: typeof isNotNil;
|
|
2501
|
+
readonly isNotEmpty: typeof isNotEmpty;
|
|
2502
|
+
readonly defaultTo: typeof defaultTo;
|
|
2503
|
+
readonly coalesce: typeof coalesce;
|
|
2504
|
+
readonly add: typeof add;
|
|
2505
|
+
readonly subtract: typeof subtract;
|
|
2506
|
+
readonly multiply: typeof multiply;
|
|
2507
|
+
readonly divide: typeof divide;
|
|
2508
|
+
readonly modulo: typeof modulo;
|
|
2509
|
+
readonly mathMod: typeof mathMod;
|
|
2510
|
+
readonly negate: typeof negate;
|
|
2511
|
+
readonly inc: typeof inc;
|
|
2512
|
+
readonly dec: typeof dec;
|
|
2513
|
+
readonly clamp: typeof clamp;
|
|
2514
|
+
readonly abs: typeof abs;
|
|
2515
|
+
readonly round: typeof round;
|
|
2516
|
+
readonly floor: typeof floor;
|
|
2517
|
+
readonly ceil: typeof ceil;
|
|
2518
|
+
readonly pow: typeof pow;
|
|
2519
|
+
readonly toUpper: typeof toUpper;
|
|
2520
|
+
readonly toLower: typeof toLower;
|
|
2521
|
+
readonly trim: typeof trim;
|
|
2522
|
+
readonly split: typeof split;
|
|
2523
|
+
readonly join: typeof join;
|
|
2524
|
+
readonly replace: typeof replace;
|
|
2525
|
+
readonly startsWith: typeof startsWith;
|
|
2526
|
+
readonly endsWith: typeof endsWith;
|
|
2527
|
+
readonly test: typeof test;
|
|
2528
|
+
readonly match: typeof match;
|
|
2529
|
+
readonly substring: typeof substring;
|
|
2530
|
+
readonly padStart: typeof padStart;
|
|
2531
|
+
readonly padEnd: typeof padEnd;
|
|
2532
|
+
readonly concatStr: typeof concatStr;
|
|
2533
|
+
readonly toString: typeof toString;
|
|
2534
|
+
readonly toNumber: typeof toNumber;
|
|
2535
|
+
readonly toBoolean: typeof toBoolean;
|
|
2536
|
+
readonly toArray: typeof toArray;
|
|
2537
|
+
readonly toObject: typeof toObject;
|
|
2538
|
+
readonly type: typeof type;
|
|
2539
|
+
readonly lens: typeof lens;
|
|
2540
|
+
readonly lensProp: typeof lensProp;
|
|
2541
|
+
readonly lensPath: typeof lensPath;
|
|
2542
|
+
readonly lensIndex: typeof lensIndex;
|
|
2543
|
+
readonly view: typeof view;
|
|
2544
|
+
readonly set: typeof set;
|
|
2545
|
+
readonly over: typeof over;
|
|
2546
|
+
readonly mapAsync: typeof mapAsync;
|
|
2547
|
+
readonly mapSerial: typeof mapSerial;
|
|
2548
|
+
readonly filterAsync: typeof filterAsync;
|
|
2549
|
+
readonly reduceAsync: typeof reduceAsync;
|
|
2550
|
+
readonly mapT: typeof mapT;
|
|
2551
|
+
readonly filterT: typeof filterT;
|
|
2552
|
+
readonly takeT: typeof takeT;
|
|
2553
|
+
readonly dropT: typeof dropT;
|
|
2554
|
+
readonly composeT: typeof composeT;
|
|
2555
|
+
readonly transduce: typeof transduce;
|
|
2556
|
+
readonly into: typeof into;
|
|
2557
|
+
};
|
|
2558
|
+
|
|
2559
|
+
export { type BinaryFn, type Comparator, type ComposeBuilderFn, type Curry1, type Curry2, type Curry3, type DeepReadonly, F, type Fn, type Head, type Last, type Lens, type Mapper, type Nullable, type ParamsOf, type PipeBuilderFn, type PipeFn, type PipeTransformer, type Placeholder, type Predicate, type Reducer, type ReturnOf, T$1 as T, type Tail, type TapFn, type TernaryFn, type Transducer, type Transformer, type UnaryFn, type VariadicFn, placeholder as __, abs, add, allPass, always, and, anyPass, append, applySpec, assoc, assocPath, both, ceil, chain, clamp, coalesce, complement, compose, composeAsync, composeK, composeT, concat, concatStr, cond, countBy, curry, curryN, dec, defaultTo, dissoc, dissocPath, divide, drop, dropLast, dropT, dropWhile, either, endsWith, entries, equals, every, evolve, extend, filter, filterAsync, filterT, find, findIndex, findLast, flatten, floor, fromEntries, groupBy, gt, gte, head, identical, identity, ifElse, inc, includes, indexBy, indexOf, init, into, is, isEmpty, isNil, isNotEmpty, isNotNil, isPlaceholder, join, keys, last, length, lens, lensIndex, lensPath, lensProp, letIn, lt, lte, map, mapAsync, mapSerial, mapT, match, mathMod, max, mean, median, merge, mergeDeep, min, modulo, multiply, negate, none, not, nth, omit, or, over, padEnd, padStart, partial, partialRight, partition, path, pathEq, pathOr, pathSatisfies, pick, pipe, pipeAsync, pipeBuilder, pipeK, pipeWith, pluck, pow, prepend, product, prop, propEq, propOr, propSatisfies, props, range, reduce, reduceAsync, reduceRight, reject, replace, reverse, round, scope, set, slice, some, sort, sortBy, split, splitEvery, startsWith, substring, subtract, sum, tail, take, takeLast, takeT, takeWhile, tap, test, toArray, toBoolean, toLower, toNumber, toObject, toString, toUpper, transduce, trim, tryCatch, type, uniq, uniqBy, unless, unnest, values, view, when, where, whereEq, zip, zipObj, zipWith };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function v(n){return n}function E(n){return function(){return n}}function F(){return true}function V(){return false}var w=Symbol.for("@@statedelta/placeholder"),D={[w]:true,__:w};function c(n){return n!==null&&typeof n=="object"&&w in n&&n[w]===true}function p(n){return function e(r){return arguments.length===0?e:n(r)}}function l(n){return function e(r,t){switch(arguments.length){case 0:return e;case 1:return c(r)?e:p(o=>n(r,o));default:return c(r)&&c(t)?e:c(r)?p(o=>n(o,t)):c(t)?p(o=>n(r,o)):n(r,t)}}}var j=l(function(e,r){return e(r),r});function k(n){return function e(r,t,o){switch(arguments.length){case 0:return e;case 1:return c(r)?e:l((s,T)=>n(r,s,T));case 2:return c(r)&&c(t)?e:c(r)?l((s,T)=>n(s,t,T)):c(t)?l((s,T)=>n(r,s,T)):p(s=>n(r,t,s));default:let u=c(r),i=c(t),a=c(o),d=(u?1:0)+(i?1:0)+(a?1:0);return d===3?e:d===2?u?i?l((s,T)=>n(s,T,o)):l((s,T)=>n(s,t,T)):l((s,T)=>n(r,s,T)):d===1?u?p(s=>n(s,t,o)):i?p(s=>n(r,s,o)):p(s=>n(r,t,s)):n(r,t,o)}}}function A(n,e,r){return function t(...o){if(o.length===0)return t;let u=[],i=0;for(let d=0;d<e.length;d++)c(e[d])&&i<o.length?(u.push(o[i]),i++):u.push(e[d]);for(;i<o.length;)u.push(o[i]),i++;let a=0;for(let d=0;d<Math.min(u.length,n);d++)c(u[d])||a++;return a>=n?r.apply(this,u.slice(0,n)):A(n,u,r)}}function N(n){let e=n.length;switch(e){case 0:return n;case 1:return p(n);case 2:return l(n);case 3:return k(n);default:return A(e,[],n)}}function O(n,e){if(n<0)throw new Error(`curryN: arity must be non-negative, got ${n}`);if(n>10)throw new Error(`curryN: arity must be at most 10, got ${n}`);switch(n){case 0:return e;case 1:return p(e);case 2:return l(e);case 3:return k(e);default:return A(n,[],e)}}function L(n,e){return function(...t){let o=[],u=0;for(let i=0;i<e.length;i++)c(e[i])&&u<t.length?(o.push(t[u]),u++):o.push(e[i]);for(;u<t.length;)o.push(t[u]),u++;return n(...o)}}function W(n,e){return function(...t){return n(...t,...e)}}var I=function(e,...r){let t=e;for(let o=0;o<r.length;o++)t=r[o](t);return t},_=function(...e){return e.length===0?r=>r:e.length===1?e[0]:function(t){let o=t;for(let u=0;u<e.length;u++)o=e[u](o);return o}};var q=function(...e){return e.length===0?r=>r:e.length===1?e[0]:function(t){let o=t;for(let u=e.length-1;u>=0;u--)o=e[u](o);return o}};function M(n,e){return e.length===0?(r=>r):function(t){let o=t;for(let u=0;u<e.length;u++)o=n(e[u],o);return o}}function z(...n){return async function(r){let t=r;for(let o=0;o<n.length;o++)t=await n[o](t);return t}}function H(...n){return async function(r){let t=r;for(let o=n.length-1;o>=0;o--)t=await n[o](t);return t}}function $(...n){return e=>r=>n.reduce((t,o)=>o(t)(r),e)}function Y(...n){return e=>r=>n.reduceRight((t,o)=>o(t)(r),e)}function dr(n,e){let r={...e};for(let[t,o]of Object.entries(n))r[t]=typeof o=="function"?o(r):o;return r}function U(n,e,r){let t=dr(n,r);return e(t)}function G(n,e,r){return e!==void 0&&r!==void 0?U(n,e,r):e!==void 0?t=>U(n,e,t):(t,o)=>o!==void 0?U(n,t,o):u=>U(n,t,u)}var J=l((n,e)=>{let r=e.length,t=new Array(r);for(let o=0;o<r;o++)t[o]=n(e[o],o,e);return t});var Q=l((n,e)=>{let r=[],t=e.length;for(let o=0;o<t;o++)n(e[o],o,e)&&r.push(e[o]);return r}),X=l((n,e)=>{let r=[],t=e.length;for(let o=0;o<t;o++)n(e[o],o,e)||r.push(e[o]);return r});var Z=k((n,e,r)=>{let t=e,o=r.length;for(let u=0;u<o;u++)t=n(t,r[u],u,r);return t}),nn=k((n,e,r)=>{let t=e;for(let o=r.length-1;o>=0;o--)t=n(t,r[o],o,r);return t});function en(n){return n[0]}function rn(n){return n.slice(1)}function tn(n){return n[n.length-1]}function on(n){return n.slice(0,-1)}function un(n,e){if(e===void 0)return t=>{let o=n<0?t.length+n:n;return t[o]};let r=n<0?e.length+n:n;return e[r]}function an(n,e){return e===void 0?r=>r.slice(0,Math.max(0,n)):e.slice(0,Math.max(0,n))}function dn(n,e){return e===void 0?r=>n<=0?[]:r.slice(-n):n<=0?[]:e.slice(-n)}function sn(n,e){let r=t=>{let o=[];for(let u=0;u<t.length&&n(t[u],u,t);u++)o.push(t[u]);return o};return e===void 0?r:r(e)}function cn(n,e){return e===void 0?r=>r.slice(Math.max(0,n)):e.slice(Math.max(0,n))}function ln(n,e){return e===void 0?r=>n<=0?r.slice():r.slice(0,-n):n<=0?e.slice():e.slice(0,-n)}function fn(n,e){let r=t=>{let o=0;for(;o<t.length&&n(t[o],o,t);)o++;return t.slice(o)};return e===void 0?r:r(e)}function Tn(n,e,r){return e!==void 0&&r!==void 0?r.slice(n,e):e!==void 0?t=>t.slice(n,e):function(o,u){return u!==void 0?u.slice(n,o):i=>i.slice(n,o)}}function pn(n,e){let r=t=>{for(let o=0;o<t.length;o++)if(n(t[o],o,t))return t[o]};return e===void 0?r:r(e)}function yn(n,e){let r=t=>{for(let o=0;o<t.length;o++)if(n(t[o],o,t))return o;return -1};return e===void 0?r:r(e)}function mn(n,e){let r=t=>{for(let o=t.length-1;o>=0;o--)if(n(t[o],o,t))return t[o]};return e===void 0?r:r(e)}function xn(n,e){let r=t=>{for(let o=0;o<t.length;o++)if(t[o]===n)return o;return -1};return e===void 0?r:r(e)}function bn(n,e){let r=t=>{for(let o=0;o<t.length;o++)if(t[o]===n)return true;return false};return e===void 0?r:r(e)}function K(n){let e=[];for(let r=0;r<n.length;r++){let t=n[r];if(Array.isArray(t))for(let o=0;o<t.length;o++)e.push(t[o]);else e.push(t);}return e}var gn=K;function Rn(n,e){let r=t=>{let o=[];for(let u=0;u<t.length;u++){let i=n(t[u],u,t);for(let a=0;a<i.length;a++)o.push(i[a]);}return o};return e===void 0?r:r(e)}function kn(n){let e=new Set,r=[];for(let t=0;t<n.length;t++){let o=n[t];e.has(o)||(e.add(o),r.push(o));}return r}function An(n,e){let r=t=>{let o=new Set,u=[];for(let i=0;i<t.length;i++){let a=t[i],d=n(a);o.has(d)||(o.add(d),u.push(a));}return u};return e===void 0?r:r(e)}function hn(n,e){return e===void 0?r=>[...r].sort(n):[...e].sort(n)}function wn(n,e){let r=(t,o)=>{let u=n(t),i=n(o);return u<i?-1:u>i?1:0};return e===void 0?t=>[...t].sort(r):[...e].sort(r)}function Un(n){let e=new Array(n.length);for(let r=0;r<n.length;r++)e[n.length-1-r]=n[r];return e}function Cn(n,e){let r=t=>{let o={};for(let u=0;u<t.length;u++){let i=t[u],a=n(i);a in o||(o[a]=[]),o[a].push(i);}return o};return e===void 0?r:r(e)}function Sn(n,e){return e===void 0?r=>[...n,...r]:[...n,...e]}function Kn(n,e){return e===void 0?r=>[...r,n]:[...e,n]}function Bn(n,e){return e===void 0?r=>[n,...r]:[n,...e]}function Pn(n,e){if(e===void 0)return o=>{let u=Math.min(n.length,o.length),i=new Array(u);for(let a=0;a<u;a++)i[a]=[n[a],o[a]];return i};let r=Math.min(n.length,e.length),t=new Array(r);for(let o=0;o<r;o++)t[o]=[n[o],e[o]];return t}function vn(n,e,r){if(e!==void 0&&r!==void 0){let t=Math.min(e.length,r.length),o=new Array(t);for(let u=0;u<t;u++)o[u]=n(e[u],r[u]);return o}return e!==void 0?t=>{let o=Math.min(e.length,t.length),u=new Array(o);for(let i=0;i<o;i++)u[i]=n(e[i],t[i]);return u}:function(o,u){if(u!==void 0){let i=Math.min(o.length,u.length),a=new Array(i);for(let d=0;d<i;d++)a[d]=n(o[d],u[d]);return a}return i=>{let a=Math.min(o.length,i.length),d=new Array(a);for(let s=0;s<a;s++)d[s]=n(o[s],i[s]);return d}}}function En(n,e){if(e===void 0)return o=>{let u={},i=Math.min(n.length,o.length);for(let a=0;a<i;a++)u[n[a]]=o[a];return u};let r={},t=Math.min(n.length,e.length);for(let o=0;o<t;o++)r[n[o]]=e[o];return r}function Fn(n,e){let r=t=>{for(let o=0;o<t.length;o++)if(n(t[o],o,t))return true;return false};return e===void 0?r:r(e)}function Vn(n,e){let r=t=>{for(let o=0;o<t.length;o++)if(!n(t[o],o,t))return false;return true};return e===void 0?r:r(e)}function Dn(n,e){let r=t=>{for(let o=0;o<t.length;o++)if(n(t[o],o,t))return false;return true};return e===void 0?r:r(e)}function jn(n){return n.length}function Nn(n){let e=0;for(let r=0;r<n.length;r++)e+=n[r];return e}function On(n){if(n.length===0)return 1;let e=1;for(let r=0;r<n.length;r++)e*=n[r];return e}function Ln(n){if(n.length===0)return NaN;let e=0;for(let r=0;r<n.length;r++)e+=n[r];return e/n.length}function Wn(n){if(n.length===0)return NaN;let e=[...n].sort((t,o)=>t-o),r=Math.floor(e.length/2);return e.length%2===0?(e[r-1]+e[r])/2:e[r]}function In(n){if(n.length===0)return 1/0;let e=n[0];for(let r=1;r<n.length;r++)n[r]<e&&(e=n[r]);return e}function _n(n){if(n.length===0)return -1/0;let e=n[0];for(let r=1;r<n.length;r++)n[r]>e&&(e=n[r]);return e}function qn(n,e){let r=t=>{let o={};for(let u=0;u<t.length;u++){let i=n(t[u]);o[i]=(o[i]||0)+1;}return o};return e===void 0?r:r(e)}function Mn(n,e){if(e===void 0)return t=>{if(n>=t)return [];let o=new Array(t-n);for(let u=0;u<o.length;u++)o[u]=n+u;return o};if(n>=e)return [];let r=new Array(e-n);for(let t=0;t<r.length;t++)r[t]=n+t;return r}function zn(n,e){let r=t=>{let o=[],u=[];for(let i=0;i<t.length;i++)n(t[i],i,t)?o.push(t[i]):u.push(t[i]);return [o,u]};return e===void 0?r:r(e)}function Hn(n,e){if(e===void 0)return t=>{if(n<=0)return [];let o=[];for(let u=0;u<t.length;u+=n)o.push(t.slice(u,u+n));return o};if(n<=0)return [];let r=[];for(let t=0;t<e.length;t+=n)r.push(e.slice(t,t+n));return r}function $n(n,e){let r=t=>{let o={};for(let u=0;u<t.length;u++){let i=n(t[u]);o[i]=t[u];}return o};return e===void 0?r:r(e)}function Yn(n,e){return e===void 0?r=>r[n]:e[n]}function f(n,e){if(e===void 0)return t=>f(n,t);let r=e;for(let t of n){if(r==null)return;r=r[t];}return r}function Gn(n,e,r){if(e===void 0)return (o,u)=>{if(u===void 0)return a=>{let d=a[o];return d??n};let i=u[o];return i??n};if(r===void 0)return o=>{let u=o[e];return u??n};let t=r[e];return t??n}function Jn(n,e,r){if(e===void 0)return (o,u)=>{if(u===void 0)return a=>{let d=f(o,a);return d??n};let i=f(o,u);return i??n};if(r===void 0)return o=>{let u=f(e,o);return u??n};let t=f(e,r);return t??n}function Qn(n,e){return e===void 0?r=>n.map(t=>r[t]):n.map(r=>e[r])}function Xn(n,e){return e===void 0?r=>r.map(t=>t[n]):e.map(r=>r[n])}function Zn(n,e,r){return e===void 0?(t,o)=>o===void 0?u=>({...u,[n]:t}):{...o,[n]:t}:r===void 0?t=>({...t,[n]:e}):{...r,[n]:e}}function g(n,e,r){if(n.length===0)return e;let[t,...o]=n,u=typeof t=="number";if(r==null){let a=u?[]:{};if(o.length===0){if(u){let d=a;return d[t]=e,d}return {...a,[t]:e}}if(u){let d=a;return d[t]=g(o,e,void 0),d}return {...a,[t]:g(o,e,void 0)}}if(Array.isArray(r)){let a=[...r];return a[t]=o.length===0?e:g(o,e,r[t]),a}let i=r;return {...i,[t]:o.length===0?e:g(o,e,i[t])}}function ne(n,e,r){return e===void 0?(t,o)=>o===void 0?u=>g(n,t,u):g(n,t,o):r===void 0?t=>g(n,e,t):g(n,e,r)}function ee(n,e){if(e===void 0)return o=>{let{[n]:u,...i}=o;return i};let{[n]:r,...t}=e;return t}function C(n,e){if(n.length===0||e===null||e===void 0)return e;let[r,...t]=n;if(t.length===0){if(Array.isArray(e)){let a=[...e];return a.splice(r,1),a}let{[r]:u,...i}=e;return i}if(Array.isArray(e)){let u=[...e];return u[r]=C(t,e[r]),u}let o=e;return {...o,[r]:C(t,o[r])}}function re(n,e){return e===void 0?r=>C(n,r):C(n,e)}function te(n,e){if(e===void 0)return t=>{let o={};for(let u of n)u in t&&(o[u]=t[u]);return o};let r={};for(let t of n)t in e&&(r[t]=e[t]);return r}function oe(n,e){let r=new Set(n);if(e===void 0)return o=>{let u={};for(let i in o)r.has(i)||(u[i]=o[i]);return u};let t={};for(let o in e)r.has(o)||(t[o]=e[o]);return t}function ue(n,e){return e===void 0?r=>({...n,...r}):{...n,...e}}function h(n){return n!==null&&typeof n=="object"&&!Array.isArray(n)}function ie(n,e){let r=(t,o)=>{let u={...t};for(let i in o)h(t[i])&&h(o[i])?u[i]=r(t[i],o[i]):u[i]=o[i];return u};return e===void 0?t=>r(n,t):r(n,e)}function ae(n,e){let r=(t,o)=>{let u={...o};for(let i in t)if(i in o){let a=t[i];typeof a=="function"?u[i]=a(o[i]):h(a)&&h(o[i])&&(u[i]=r(a,o[i]));}return u};return e===void 0?t=>r(n,t):r(n,e)}function de(n){let e=(r,t)=>{let o={};for(let u in r){let i=r[u];typeof i=="function"?o[u]=i(...t):h(i)?o[u]=e(i,t):o[u]=i;}return o};return (...r)=>e(n,r)}function se(n,e){let r=(t,o)=>{let u={};for(let i in t)u[i]=t[i](o);return {...o,...u}};return e===void 0?t=>r(n,t):r(n,e)}function ce(n){return Object.keys(n)}function le(n){return Object.values(n)}function fe(n){return Object.entries(n)}function Te(n){return Object.fromEntries(n)}function S(n,e){if(n===e)return true;if(n===null||e===null)return n===e;if(typeof n!=typeof e)return false;if(typeof n=="object"){if(Array.isArray(n)&&Array.isArray(e))return n.length!==e.length?false:n.every((i,a)=>S(i,e[a]));if(Array.isArray(n)||Array.isArray(e))return false;let r=n,t=e,o=Object.keys(r),u=Object.keys(t);return o.length!==u.length?false:o.every(i=>S(r[i],t[i]))}return false}function y(n,e){return e===void 0&&arguments.length===1?r=>S(n,r):S(n,e)}function pe(n,e){return e===void 0&&arguments.length===1?r=>n===r:n===e}function ye(n,e){return e===void 0?r=>r>n:n>e}function me(n,e){return e===void 0?r=>r>=n:n>=e}function xe(n,e){return e===void 0?r=>r<n:n<e}function be(n,e){return e===void 0?r=>r<=n:n<=e}function ge(n){return !n}function Re(n,e){return e===void 0&&arguments.length===1?r=>n&&r:n&&e}function ke(n,e){return e===void 0&&arguments.length===1?r=>n||r:n||e}function Ae(n,e){return e===void 0?r=>t=>n(t)&&r(t):r=>n(r)&&e(r)}function he(n,e){return e===void 0?r=>t=>n(t)||r(t):r=>n(r)||e(r)}function we(n){return e=>!n(e)}function Ue(n){return e=>n.every(r=>r(e))}function Ce(n){return e=>n.some(r=>r(e))}function Se(n,e,r){return t=>n(t)?e(t):r(t)}function Ke(n,e){return r=>n(r)?e(r):r}function Be(n,e){return r=>n(r)?r:e(r)}function Pe(n){return e=>{for(let[r,t]of n)if(r(e))return t(e)}}function ve(n,e){return r=>{try{return n(r)}catch(t){return e(t,r)}}}function Ee(n,e,r){return arguments.length===1?(t,o)=>o===void 0?u=>y(u[n],t):y(o[n],t):r===void 0?t=>y(t[n],e):y(r[n],e)}function Fe(n,e,r){return e===void 0?(t,o)=>o===void 0?u=>n(u[t]):n(o[t]):r===void 0?t=>n(t[e]):n(r[e])}function Ve(n,e,r){return e===void 0&&arguments.length===1?(t,o)=>o===void 0?u=>y(f(n,u),t):y(f(n,o),t):r===void 0?t=>y(f(n,t),e):y(f(n,r),e)}function De(n,e,r){return e===void 0?(t,o)=>o===void 0?u=>n(f(t,u)):n(f(t,o)):r===void 0?t=>n(f(e,t)):n(f(e,r))}function je(n,e){let r=t=>{for(let o in n){let u=n[o];if(u&&!u(t[o]))return false}return true};return e===void 0?r:r(e)}function Ne(n,e){let r=t=>{for(let o in n)if(!y(n[o],t[o]))return false;return true};return e===void 0?r:r(e)}function Oe(n,e){return e===void 0&&arguments.length===1?r=>r==null?false:r instanceof n||r.constructor===n:e==null?false:e instanceof n||e.constructor===n}function Le(n){return n==null}function We(n){return n!=null}function B(n){return n==null?true:typeof n=="string"||Array.isArray(n)?n.length===0:typeof n=="object"?Object.keys(n).length===0:false}function Ie(n){return !B(n)}function _e(n,e){return e===void 0&&arguments.length===1?r=>r==null||typeof r=="number"&&Number.isNaN(r)?n:r:e==null||typeof e=="number"&&Number.isNaN(e)?n:e}function qe(...n){for(let e of n)if(e!=null)return e}function sr(n,e){return e===void 0?r=>n+r:n+e}function cr(n,e){return e===void 0?r=>n-r:n-e}function lr(n,e){return e===void 0?r=>n*r:n*e}function fr(n,e){return e===void 0?r=>n/r:n/e}function Tr(n,e){return e===void 0?r=>n%r:n%e}function pr(n,e){return e===void 0?r=>!Number.isInteger(n)||!Number.isInteger(r)||r<=0?NaN:(n%r+r)%r:!Number.isInteger(n)||!Number.isInteger(e)||e<=0?NaN:(n%e+e)%e}function yr(n){return -n}function mr(n){return n+1}function xr(n){return n-1}function br(n,e,r){return r===void 0?t=>Math.min(e,Math.max(n,t)):Math.min(e,Math.max(n,r))}function gr(n){return Math.abs(n)}function Rr(n){return Math.round(n)}function kr(n){return Math.floor(n)}function Ar(n){return Math.ceil(n)}function hr(n,e){return e===void 0?r=>Math.pow(r,n):Math.pow(e,n)}function wr(n){return n.toUpperCase()}function Ur(n){return n.toLowerCase()}function Cr(n){return n.trim()}function Sr(n,e){return e===void 0?r=>r.split(n):e.split(n)}function Kr(n,e){return e===void 0?r=>r.join(n):e.join(n)}function Br(n,e,r){return r===void 0?t=>t.replace(n,e):r.replace(n,e)}function Pr(n,e){return e===void 0?r=>r.startsWith(n):e.startsWith(n)}function vr(n,e){return e===void 0?r=>r.endsWith(n):e.endsWith(n)}function Er(n,e){return e===void 0?r=>n.test(r):n.test(e)}function Fr(n,e){return e===void 0?r=>r.match(n):e.match(n)}function Vr(n,e,r){return typeof e=="string"?e.substring(n):r===void 0?t=>t.substring(n,e):r.substring(n,e)}function Dr(n,e,r){return typeof e=="string"&&r===void 0&&e.length>1,r===void 0?t=>t.padStart(n,e):r.padStart(n,e)}function jr(n,e,r){return r===void 0?t=>t.padEnd(n,e):r.padEnd(n,e)}function Nr(n,e){return e===void 0?r=>n+r:n+e}function Or(n){return n===null?"null":n===void 0?"undefined":String(n)}function Lr(n){return typeof n=="number"?n:typeof n=="string"?Number(n):typeof n=="boolean"?n?1:0:n==null?NaN:Number(n)}function Wr(n){return !!n}function Ir(n){return Array.isArray(n)?[...n]:n==null?[]:typeof n=="string"?[...n]:typeof n[Symbol.iterator]=="function"?[...n]:[n]}function _r(n){return n==null?{}:typeof n=="object"?n:Object(n)}function qr(n){return n===null?"Null":n===void 0?"Undefined":Object.prototype.toString.call(n).slice(8,-1)}function Me(n,e){return {get:n,set:e}}function ze(n){return {get:e=>e[n],set:(e,r)=>({...r,[n]:e})}}function He(n){return {get:e=>{let r=e;for(let t of n){if(r==null)return;r=r[t];}return r},set:(e,r)=>{if(n.length===0)return e;let t=(o,u,i)=>{let[a,...d]=o,s=typeof a=="number";if(d.length===0){if(Array.isArray(i)){let R=[...i];return R[a]=u,R}return {...i,[a]:u}}if(i==null){let R=s?[]:{};if(s){let P=R;return P[a]=t(d,u,void 0),P}return {[a]:t(d,u,void 0)}}if(Array.isArray(i)){let R=[...i];return R[a]=t(d,u,i[a]),R}let T=i;return {...T,[a]:t(d,u,T[a])}};return t(n,e,r)}}}function $e(n){return {get:e=>e[n],set:(e,r)=>{let t=[...r];return t[n]=e,t}}}function Ye(n,e){return e===void 0?r=>n.get(r):n.get(e)}function Ge(n,e,r){return e===void 0?(t,o)=>o===void 0?u=>n.set(t,u):n.set(t,o):r===void 0?t=>n.set(e,t):n.set(e,r)}function Je(n,e,r){return e===void 0?(t,o)=>o===void 0?u=>n.set(t(n.get(u)),u):n.set(t(n.get(o)),o):r===void 0?t=>n.set(e(n.get(t)),t):n.set(e(n.get(r)),r)}function Qe(n,e){return e===void 0?r=>Promise.all(r.map((t,o)=>n(t,o))):Promise.all(e.map((r,t)=>n(r,t)))}function Xe(n,e){let r=async t=>{let o=[];for(let u=0;u<t.length;u++)o.push(await n(t[u],u));return o};return e===void 0?t=>r(t):r(e)}function Ze(n,e){let r=async t=>(await Promise.all(t.map(async(u,i)=>({item:u,keep:await n(u,i)})))).filter(({keep:u})=>u).map(({item:u})=>u);return e===void 0?t=>r(t):r(e)}function nr(n,e,r){let t=async o=>{let u=e;for(let i=0;i<o.length;i++)u=await n(u,o[i],i);return u};return r===void 0?o=>t(o):t(r)}var b="@@transducer/init",m="@@transducer/step",x="@@transducer/result";function er(n){return e=>({[b]:()=>e[b](),[m]:(r,t)=>e[m](r,n(t)),[x]:r=>e[x](r)})}function rr(n){return e=>({[b]:()=>e[b](),[m]:(r,t)=>n(t)?e[m](r,t):r,[x]:r=>e[x](r)})}function tr(n){return e=>{let r=0;return {[b]:()=>e[b](),[m]:(t,o)=>r<n?(r++,e[m](t,o)):t,[x]:t=>e[x](t)}}}function or(n){return e=>{let r=0;return {[b]:()=>e[b](),[m]:(t,o)=>r<n?(r++,t):e[m](t,o),[x]:t=>e[x](t)}}}function ur(...n){return e=>n.reduceRight((r,t)=>t(r),e)}function Mr(){return {[b]:()=>[],[m]:(n,e)=>(n.push(e),n),[x]:n=>n}}function ir(n,e,r,t){let o=u=>{let i=n(e),a=r;for(let d of u)a=i[m](a,d);return i[x](a)};return t===void 0?u=>o(u):o(t)}function ar(n,e){let r=t=>{let o=n(Mr()),u=o[b]();for(let i of t)u=o[m](u,i);return o[x](u)};return e===void 0?t=>r(t):r(e)}export{V as F,F as T,D as __,gr as abs,sr as add,Ue as allPass,E as always,Re as and,Ce as anyPass,Kn as append,de as applySpec,Zn as assoc,ne as assocPath,Ae as both,Ar as ceil,Rn as chain,br as clamp,qe as coalesce,we as complement,q as compose,H as composeAsync,Y as composeK,ur as composeT,Sn as concat,Nr as concatStr,Pe as cond,qn as countBy,N as curry,O as curryN,xr as dec,_e as defaultTo,ee as dissoc,re as dissocPath,fr as divide,cn as drop,ln as dropLast,or as dropT,fn as dropWhile,he as either,vr as endsWith,fe as entries,y as equals,Vn as every,ae as evolve,se as extend,Q as filter,Ze as filterAsync,rr as filterT,pn as find,yn as findIndex,mn as findLast,K as flatten,kr as floor,Te as fromEntries,Cn as groupBy,ye as gt,me as gte,en as head,pe as identical,v as identity,Se as ifElse,mr as inc,bn as includes,$n as indexBy,xn as indexOf,on as init,ar as into,Oe as is,B as isEmpty,Le as isNil,Ie as isNotEmpty,We as isNotNil,c as isPlaceholder,Kr as join,ce as keys,tn as last,jn as length,Me as lens,$e as lensIndex,He as lensPath,ze as lensProp,G as letIn,xe as lt,be as lte,J as map,Qe as mapAsync,Xe as mapSerial,er as mapT,Fr as match,pr as mathMod,_n as max,Ln as mean,Wn as median,ue as merge,ie as mergeDeep,In as min,Tr as modulo,lr as multiply,yr as negate,Dn as none,ge as not,un as nth,oe as omit,ke as or,Je as over,jr as padEnd,Dr as padStart,L as partial,W as partialRight,zn as partition,f as path,Ve as pathEq,Jn as pathOr,De as pathSatisfies,te as pick,I as pipe,z as pipeAsync,_ as pipeBuilder,$ as pipeK,M as pipeWith,Xn as pluck,hr as pow,Bn as prepend,On as product,Yn as prop,Ee as propEq,Gn as propOr,Fe as propSatisfies,Qn as props,Mn as range,Z as reduce,nr as reduceAsync,nn as reduceRight,X as reject,Br as replace,Un as reverse,Rr as round,Ge as set,Tn as slice,Fn as some,hn as sort,wn as sortBy,Sr as split,Hn as splitEvery,Pr as startsWith,Vr as substring,cr as subtract,Nn as sum,rn as tail,an as take,dn as takeLast,tr as takeT,sn as takeWhile,j as tap,Er as test,Ir as toArray,Wr as toBoolean,Ur as toLower,Lr as toNumber,_r as toObject,Or as toString,wr as toUpper,ir as transduce,Cr as trim,ve as tryCatch,qr as type,kn as uniq,An as uniqBy,Be as unless,gn as unnest,le as values,Ye as view,Ke as when,je as where,Ne as whereEq,Pn as zip,En as zipObj,vn as zipWith};
|
|
1
|
+
function C(n){return n}function S(n){return function(){return n}}function K(){return true}function B(){return false}var P=Symbol.for("@@statedelta/placeholder"),Ir={[P]:true,__:P};function c(n){return n!==null&&typeof n=="object"&&P in n&&n[P]===true}function y(n){return function e(r){return arguments.length===0?e:n(r)}}function l(n){return function e(r,t){switch(arguments.length){case 0:return e;case 1:return c(r)?e:y(o=>n(r,o));default:return c(r)&&c(t)?e:c(r)?y(o=>n(o,t)):c(t)?y(o=>n(r,o)):n(r,t)}}}var v=l(function(e,r){return e(r),r});function k(n){return function e(r,t,o){switch(arguments.length){case 0:return e;case 1:return c(r)?e:l((s,p)=>n(r,s,p));case 2:return c(r)&&c(t)?e:c(r)?l((s,p)=>n(s,t,p)):c(t)?l((s,p)=>n(r,s,p)):y(s=>n(r,t,s));default:let u=c(r),i=c(t),a=c(o),d=(u?1:0)+(i?1:0)+(a?1:0);return d===3?e:d===2?u?i?l((s,p)=>n(s,p,o)):l((s,p)=>n(s,t,p)):l((s,p)=>n(r,s,p)):d===1?u?y(s=>n(s,t,o)):i?y(s=>n(r,s,o)):y(s=>n(r,t,s)):n(r,t,o)}}}function h(n,e,r){return function t(...o){if(o.length===0)return t;let u=[],i=0;for(let d=0;d<e.length;d++)c(e[d])&&i<o.length?(u.push(o[i]),i++):u.push(e[d]);for(;i<o.length;)u.push(o[i]),i++;let a=0;for(let d=0;d<Math.min(u.length,n);d++)c(u[d])||a++;return a>=n?r.apply(this,u.slice(0,n)):h(n,u,r)}}function E(n){let e=n.length;switch(e){case 0:return n;case 1:return y(n);case 2:return l(n);case 3:return k(n);default:return h(e,[],n)}}function F(n,e){if(n<0)throw new Error(`curryN: arity must be non-negative, got ${n}`);if(n>10)throw new Error(`curryN: arity must be at most 10, got ${n}`);switch(n){case 0:return e;case 1:return y(e);case 2:return l(e);case 3:return k(e);default:return h(n,[],e)}}function V(n,e){return function(...t){let o=[],u=0;for(let i=0;i<e.length;i++)c(e[i])&&u<t.length?(o.push(t[u]),u++):o.push(e[i]);for(;u<t.length;)o.push(t[u]),u++;return n(...o)}}function j(n,e){return function(...t){return n(...t,...e)}}var D=function(e,...r){let t=e;for(let o=0;o<r.length;o++)t=r[o](t);return t},N=function(...e){return e.length===0?r=>r:e.length===1?e[0]:function(t){let o=t;for(let u=0;u<e.length;u++)o=e[u](o);return o}};var O=function(...e){return e.length===0?r=>r:e.length===1?e[0]:function(t){let o=t;for(let u=e.length-1;u>=0;u--)o=e[u](o);return o}};function L(n,e){return e.length===0?(r=>r):function(t){let o=t;for(let u=0;u<e.length;u++)o=n(e[u],o);return o}}function W(...n){return async function(r){let t=r;for(let o=0;o<n.length;o++)t=await n[o](t);return t}}function q(...n){return async function(r){let t=r;for(let o=n.length-1;o>=0;o--)t=await n[o](t);return t}}function I(...n){return e=>r=>n.reduce((t,o)=>o(t)(r),e)}function _(...n){return e=>r=>n.reduceRight((t,o)=>o(t)(r),e)}function _r(n,e){let r={...e};for(let[t,o]of Object.entries(n))r[t]=typeof o=="function"?o(r):o;return r}function M(n,e,r){let t=_r(n,r);return e(t)}function z(n,e,r){return e!==void 0&&r!==void 0?M(n,e,r):e!==void 0?t=>M(n,e,t):(t,o)=>o!==void 0?M(n,t,o):u=>M(n,t,u)}var H=l((n,e)=>{let r=e.length,t=new Array(r);for(let o=0;o<r;o++)t[o]=n(e[o],o,e);return t});var $=l((n,e)=>{let r=[],t=e.length;for(let o=0;o<t;o++)n(e[o],o,e)&&r.push(e[o]);return r}),Y=l((n,e)=>{let r=[],t=e.length;for(let o=0;o<t;o++)n(e[o],o,e)||r.push(e[o]);return r});var G=k((n,e,r)=>{let t=e,o=r.length;for(let u=0;u<o;u++)t=n(t,r[u],u,r);return t}),J=k((n,e,r)=>{let t=e;for(let o=r.length-1;o>=0;o--)t=n(t,r[o],o,r);return t});function Q(n){return n[0]}function X(n){return n.slice(1)}function Z(n){return n[n.length-1]}function nn(n){return n.slice(0,-1)}function en(n,e){if(e===void 0)return t=>{let o=n<0?t.length+n:n;return t[o]};let r=n<0?e.length+n:n;return e[r]}function rn(n,e){return e===void 0?r=>r.slice(0,Math.max(0,n)):e.slice(0,Math.max(0,n))}function tn(n,e){return e===void 0?r=>n<=0?[]:r.slice(-n):n<=0?[]:e.slice(-n)}function on(n,e){let r=t=>{let o=[];for(let u=0;u<t.length&&n(t[u],u,t);u++)o.push(t[u]);return o};return e===void 0?r:r(e)}function un(n,e){return e===void 0?r=>r.slice(Math.max(0,n)):e.slice(Math.max(0,n))}function an(n,e){return e===void 0?r=>n<=0?r.slice():r.slice(0,-n):n<=0?e.slice():e.slice(0,-n)}function dn(n,e){let r=t=>{let o=0;for(;o<t.length&&n(t[o],o,t);)o++;return t.slice(o)};return e===void 0?r:r(e)}function sn(n,e,r){return e!==void 0&&r!==void 0?r.slice(n,e):e!==void 0?t=>t.slice(n,e):function(o,u){return u!==void 0?u.slice(n,o):i=>i.slice(n,o)}}function cn(n,e){let r=t=>{for(let o=0;o<t.length;o++)if(n(t[o],o,t))return t[o]};return e===void 0?r:r(e)}function ln(n,e){let r=t=>{for(let o=0;o<t.length;o++)if(n(t[o],o,t))return o;return -1};return e===void 0?r:r(e)}function fn(n,e){let r=t=>{for(let o=t.length-1;o>=0;o--)if(n(t[o],o,t))return t[o]};return e===void 0?r:r(e)}function pn(n,e){let r=t=>{for(let o=0;o<t.length;o++)if(t[o]===n)return o;return -1};return e===void 0?r:r(e)}function Tn(n,e){let r=t=>{for(let o=0;o<t.length;o++)if(t[o]===n)return true;return false};return e===void 0?r:r(e)}function A(n){let e=[];for(let r=0;r<n.length;r++){let t=n[r];if(Array.isArray(t))for(let o=0;o<t.length;o++)e.push(t[o]);else e.push(t);}return e}var yn=A;function mn(n,e){let r=t=>{let o=[];for(let u=0;u<t.length;u++){let i=n(t[u],u,t);for(let a=0;a<i.length;a++)o.push(i[a]);}return o};return e===void 0?r:r(e)}function xn(n){let e=new Set,r=[];for(let t=0;t<n.length;t++){let o=n[t];e.has(o)||(e.add(o),r.push(o));}return r}function bn(n,e){let r=t=>{let o=new Set,u=[];for(let i=0;i<t.length;i++){let a=t[i],d=n(a);o.has(d)||(o.add(d),u.push(a));}return u};return e===void 0?r:r(e)}function gn(n,e){return e===void 0?r=>[...r].sort(n):[...e].sort(n)}function Rn(n,e){let r=(t,o)=>{let u=n(t),i=n(o);return u<i?-1:u>i?1:0};return e===void 0?t=>[...t].sort(r):[...e].sort(r)}function kn(n){let e=new Array(n.length);for(let r=0;r<n.length;r++)e[n.length-1-r]=n[r];return e}function hn(n,e){let r=t=>{let o={};for(let u=0;u<t.length;u++){let i=t[u],a=n(i);a in o||(o[a]=[]),o[a].push(i);}return o};return e===void 0?r:r(e)}function An(n,e){return e===void 0?r=>[...n,...r]:[...n,...e]}function wn(n,e){return e===void 0?r=>[...r,n]:[...e,n]}function Un(n,e){return e===void 0?r=>[n,...r]:[n,...e]}function Cn(n,e){if(e===void 0)return o=>{let u=Math.min(n.length,o.length),i=new Array(u);for(let a=0;a<u;a++)i[a]=[n[a],o[a]];return i};let r=Math.min(n.length,e.length),t=new Array(r);for(let o=0;o<r;o++)t[o]=[n[o],e[o]];return t}function Sn(n,e,r){if(e!==void 0&&r!==void 0){let t=Math.min(e.length,r.length),o=new Array(t);for(let u=0;u<t;u++)o[u]=n(e[u],r[u]);return o}return e!==void 0?t=>{let o=Math.min(e.length,t.length),u=new Array(o);for(let i=0;i<o;i++)u[i]=n(e[i],t[i]);return u}:function(o,u){if(u!==void 0){let i=Math.min(o.length,u.length),a=new Array(i);for(let d=0;d<i;d++)a[d]=n(o[d],u[d]);return a}return i=>{let a=Math.min(o.length,i.length),d=new Array(a);for(let s=0;s<a;s++)d[s]=n(o[s],i[s]);return d}}}function Kn(n,e){if(e===void 0)return o=>{let u={},i=Math.min(n.length,o.length);for(let a=0;a<i;a++)u[n[a]]=o[a];return u};let r={},t=Math.min(n.length,e.length);for(let o=0;o<t;o++)r[n[o]]=e[o];return r}function Bn(n,e){let r=t=>{for(let o=0;o<t.length;o++)if(n(t[o],o,t))return true;return false};return e===void 0?r:r(e)}function Pn(n,e){let r=t=>{for(let o=0;o<t.length;o++)if(!n(t[o],o,t))return false;return true};return e===void 0?r:r(e)}function vn(n,e){let r=t=>{for(let o=0;o<t.length;o++)if(n(t[o],o,t))return false;return true};return e===void 0?r:r(e)}function En(n){return n.length}function Fn(n){let e=0;for(let r=0;r<n.length;r++)e+=n[r];return e}function Vn(n){if(n.length===0)return 1;let e=1;for(let r=0;r<n.length;r++)e*=n[r];return e}function jn(n){if(n.length===0)return NaN;let e=0;for(let r=0;r<n.length;r++)e+=n[r];return e/n.length}function Dn(n){if(n.length===0)return NaN;let e=[...n].sort((t,o)=>t-o),r=Math.floor(e.length/2);return e.length%2===0?(e[r-1]+e[r])/2:e[r]}function Nn(n){if(n.length===0)return 1/0;let e=n[0];for(let r=1;r<n.length;r++)n[r]<e&&(e=n[r]);return e}function On(n){if(n.length===0)return -1/0;let e=n[0];for(let r=1;r<n.length;r++)n[r]>e&&(e=n[r]);return e}function Ln(n,e){let r=t=>{let o={};for(let u=0;u<t.length;u++){let i=n(t[u]);o[i]=(o[i]||0)+1;}return o};return e===void 0?r:r(e)}function Wn(n,e){if(e===void 0)return t=>{if(n>=t)return [];let o=new Array(t-n);for(let u=0;u<o.length;u++)o[u]=n+u;return o};if(n>=e)return [];let r=new Array(e-n);for(let t=0;t<r.length;t++)r[t]=n+t;return r}function qn(n,e){let r=t=>{let o=[],u=[];for(let i=0;i<t.length;i++)n(t[i],i,t)?o.push(t[i]):u.push(t[i]);return [o,u]};return e===void 0?r:r(e)}function In(n,e){if(e===void 0)return t=>{if(n<=0)return [];let o=[];for(let u=0;u<t.length;u+=n)o.push(t.slice(u,u+n));return o};if(n<=0)return [];let r=[];for(let t=0;t<e.length;t+=n)r.push(e.slice(t,t+n));return r}function _n(n,e){let r=t=>{let o={};for(let u=0;u<t.length;u++){let i=n(t[u]);o[i]=t[u];}return o};return e===void 0?r:r(e)}function Mn(n,e){return e===void 0?r=>r[n]:e[n]}function f(n,e){if(e===void 0)return t=>f(n,t);let r=e;for(let t of n){if(r==null)return;r=r[t];}return r}function zn(n,e,r){if(e===void 0)return (o,u)=>{if(u===void 0)return a=>{let d=a[o];return d??n};let i=u[o];return i??n};if(r===void 0)return o=>{let u=o[e];return u??n};let t=r[e];return t??n}function Hn(n,e,r){if(e===void 0)return (o,u)=>{if(u===void 0)return a=>{let d=f(o,a);return d??n};let i=f(o,u);return i??n};if(r===void 0)return o=>{let u=f(e,o);return u??n};let t=f(e,r);return t??n}function $n(n,e){return e===void 0?r=>n.map(t=>r[t]):n.map(r=>e[r])}function Yn(n,e){return e===void 0?r=>r.map(t=>t[n]):e.map(r=>r[n])}function Jn(n,e,r){return e===void 0?(t,o)=>o===void 0?u=>({...u,[n]:t}):{...o,[n]:t}:r===void 0?t=>({...t,[n]:e}):{...r,[n]:e}}function g(n,e,r){if(n.length===0)return e;let[t,...o]=n,u=typeof t=="number";if(r==null){let a=u?[]:{};if(o.length===0){if(u){let d=a;return d[t]=e,d}return {...a,[t]:e}}if(u){let d=a;return d[t]=g(o,e,void 0),d}return {...a,[t]:g(o,e,void 0)}}if(Array.isArray(r)){let a=[...r];return a[t]=o.length===0?e:g(o,e,r[t]),a}let i=r;return {...i,[t]:o.length===0?e:g(o,e,i[t])}}function Qn(n,e,r){return e===void 0?(t,o)=>o===void 0?u=>g(n,t,u):g(n,t,o):r===void 0?t=>g(n,e,t):g(n,e,r)}function Xn(n,e){if(e===void 0)return o=>{let{[n]:u,...i}=o;return i};let{[n]:r,...t}=e;return t}function Gn(n,e){if(n.length===0||e===null||e===void 0)return e;let[r,...t]=n;if(t.length===0){if(Array.isArray(e)){let a=[...e];return a.splice(r,1),a}let{[r]:u,...i}=e;return i}if(Array.isArray(e)){let u=[...e];return u[r]=Gn(t,e[r]),u}let o=e;return {...o,[r]:Gn(t,o[r])}}function Zn(n,e){return e===void 0?r=>Gn(n,r):Gn(n,e)}function ne(n,e){if(e===void 0)return t=>{let o={};for(let u of n)u in t&&(o[u]=t[u]);return o};let r={};for(let t of n)t in e&&(r[t]=e[t]);return r}function ee(n,e){let r=new Set(n);if(e===void 0)return o=>{let u={};for(let i in o)r.has(i)||(u[i]=o[i]);return u};let t={};for(let o in e)r.has(o)||(t[o]=e[o]);return t}function re(n,e){return e===void 0?r=>({...n,...r}):{...n,...e}}function w(n){return n!==null&&typeof n=="object"&&!Array.isArray(n)}function te(n,e){let r=(t,o)=>{let u={...t};for(let i in o)w(t[i])&&w(o[i])?u[i]=r(t[i],o[i]):u[i]=o[i];return u};return e===void 0?t=>r(n,t):r(n,e)}function oe(n,e){let r=(t,o)=>{let u={...o};for(let i in t)if(i in o){let a=t[i];typeof a=="function"?u[i]=a(o[i]):w(a)&&w(o[i])&&(u[i]=r(a,o[i]));}return u};return e===void 0?t=>r(n,t):r(n,e)}function ue(n){let e=(r,t)=>{let o={};for(let u in r){let i=r[u];typeof i=="function"?o[u]=i(...t):w(i)?o[u]=e(i,t):o[u]=i;}return o};return (...r)=>e(n,r)}function ie(n,e){let r=(t,o)=>{let u={};for(let i in t)u[i]=t[i](o);return {...o,...u}};return e===void 0?t=>r(n,t):r(n,e)}function ae(n){return Object.keys(n)}function de(n){return Object.values(n)}function se(n){return Object.entries(n)}function ce(n){return Object.fromEntries(n)}function le(n,e){if(n===e)return true;if(n===null||e===null)return n===e;if(typeof n!=typeof e)return false;if(typeof n=="object"){if(Array.isArray(n)&&Array.isArray(e))return n.length!==e.length?false:n.every((i,a)=>le(i,e[a]));if(Array.isArray(n)||Array.isArray(e))return false;let r=n,t=e,o=Object.keys(r),u=Object.keys(t);return o.length!==u.length?false:o.every(i=>le(r[i],t[i]))}return false}function T(n,e){return e===void 0&&arguments.length===1?r=>le(n,r):le(n,e)}function fe(n,e){return e===void 0&&arguments.length===1?r=>n===r:n===e}function pe(n,e){return e===void 0?r=>r>n:n>e}function Te(n,e){return e===void 0?r=>r>=n:n>=e}function ye(n,e){return e===void 0?r=>r<n:n<e}function me(n,e){return e===void 0?r=>r<=n:n<=e}function xe(n){return !n}function be(n,e){return e===void 0&&arguments.length===1?r=>n&&r:n&&e}function ge(n,e){return e===void 0&&arguments.length===1?r=>n||r:n||e}function Re(n,e){return e===void 0?r=>t=>n(t)&&r(t):r=>n(r)&&e(r)}function ke(n,e){return e===void 0?r=>t=>n(t)||r(t):r=>n(r)||e(r)}function he(n){return e=>!n(e)}function Ae(n){return e=>n.every(r=>r(e))}function we(n){return e=>n.some(r=>r(e))}function Ue(n,e,r){return t=>n(t)?e(t):r(t)}function Ce(n,e){return r=>n(r)?e(r):r}function Se(n,e){return r=>n(r)?r:e(r)}function Ke(n){return e=>{for(let[r,t]of n)if(r(e))return t(e)}}function Be(n,e){return r=>{try{return n(r)}catch(t){return e(t,r)}}}function Pe(n,e,r){return arguments.length===1?(t,o)=>o===void 0?u=>T(u[n],t):T(o[n],t):r===void 0?t=>T(t[n],e):T(r[n],e)}function ve(n,e,r){return e===void 0?(t,o)=>o===void 0?u=>n(u[t]):n(o[t]):r===void 0?t=>n(t[e]):n(r[e])}function Ee(n,e,r){return e===void 0&&arguments.length===1?(t,o)=>o===void 0?u=>T(f(n,u),t):T(f(n,o),t):r===void 0?t=>T(f(n,t),e):T(f(n,r),e)}function Fe(n,e,r){return e===void 0?(t,o)=>o===void 0?u=>n(f(t,u)):n(f(t,o)):r===void 0?t=>n(f(e,t)):n(f(e,r))}function Ve(n,e){let r=t=>{for(let o in n){let u=n[o];if(u&&!u(t[o]))return false}return true};return e===void 0?r:r(e)}function je(n,e){let r=t=>{for(let o in n)if(!T(n[o],t[o]))return false;return true};return e===void 0?r:r(e)}function De(n,e){return e===void 0&&arguments.length===1?r=>r==null?false:r instanceof n||r.constructor===n:e==null?false:e instanceof n||e.constructor===n}function Ne(n){return n==null}function Oe(n){return n!=null}function U(n){return n==null?true:typeof n=="string"||Array.isArray(n)?n.length===0:typeof n=="object"?Object.keys(n).length===0:false}function Le(n){return !U(n)}function We(n,e){return e===void 0&&arguments.length===1?r=>r==null||typeof r=="number"&&Number.isNaN(r)?n:r:e==null||typeof e=="number"&&Number.isNaN(e)?n:e}function qe(...n){for(let e of n)if(e!=null)return e}function ir(n,e){return e===void 0?r=>n+r:n+e}function ar(n,e){return e===void 0?r=>n-r:n-e}function dr(n,e){return e===void 0?r=>n*r:n*e}function sr(n,e){return e===void 0?r=>n/r:n/e}function cr(n,e){return e===void 0?r=>n%r:n%e}function lr(n,e){return e===void 0?r=>!Number.isInteger(n)||!Number.isInteger(r)||r<=0?NaN:(n%r+r)%r:!Number.isInteger(n)||!Number.isInteger(e)||e<=0?NaN:(n%e+e)%e}function fr(n){return -n}function pr(n){return n+1}function Tr(n){return n-1}function yr(n,e,r){return r===void 0?t=>Math.min(e,Math.max(n,t)):Math.min(e,Math.max(n,r))}function mr(n){return Math.abs(n)}function xr(n){return Math.round(n)}function br(n){return Math.floor(n)}function gr(n){return Math.ceil(n)}function Rr(n,e){return e===void 0?r=>Math.pow(r,n):Math.pow(e,n)}function kr(n){return n.toUpperCase()}function hr(n){return n.toLowerCase()}function Ar(n){return n.trim()}function wr(n,e){return e===void 0?r=>r.split(n):e.split(n)}function Ur(n,e){return e===void 0?r=>r.join(n):e.join(n)}function Cr(n,e,r){return r===void 0?t=>t.replace(n,e):r.replace(n,e)}function Sr(n,e){return e===void 0?r=>r.startsWith(n):e.startsWith(n)}function Kr(n,e){return e===void 0?r=>r.endsWith(n):e.endsWith(n)}function Br(n,e){return e===void 0?r=>n.test(r):n.test(e)}function Pr(n,e){return e===void 0?r=>r.match(n):e.match(n)}function vr(n,e,r){return typeof e=="string"?e.substring(n):r===void 0?t=>t.substring(n,e):r.substring(n,e)}function Er(n,e,r){return typeof e=="string"&&r===void 0&&e.length>1,r===void 0?t=>t.padStart(n,e):r.padStart(n,e)}function Fr(n,e,r){return r===void 0?t=>t.padEnd(n,e):r.padEnd(n,e)}function Vr(n,e){return e===void 0?r=>n+r:n+e}function jr(n){return n===null?"null":n===void 0?"undefined":String(n)}function Dr(n){return typeof n=="number"?n:typeof n=="string"?Number(n):typeof n=="boolean"?n?1:0:n==null?NaN:Number(n)}function Nr(n){return !!n}function Or(n){return Array.isArray(n)?[...n]:n==null?[]:typeof n=="string"?[...n]:typeof n[Symbol.iterator]=="function"?[...n]:[n]}function Lr(n){return n==null?{}:typeof n=="object"?n:Object(n)}function Wr(n){return n===null?"Null":n===void 0?"Undefined":Object.prototype.toString.call(n).slice(8,-1)}function Ie(n,e){return {get:n,set:e}}function _e(n){return {get:e=>e[n],set:(e,r)=>({...r,[n]:e})}}function Me(n){return {get:e=>{let r=e;for(let t of n){if(r==null)return;r=r[t];}return r},set:(e,r)=>{if(n.length===0)return e;let t=(o,u,i)=>{let[a,...d]=o,s=typeof a=="number";if(d.length===0){if(Array.isArray(i)){let R=[...i];return R[a]=u,R}return {...i,[a]:u}}if(i==null){let R=s?[]:{};if(s){let qr=R;return qr[a]=t(d,u,void 0),qr}return {[a]:t(d,u,void 0)}}if(Array.isArray(i)){let R=[...i];return R[a]=t(d,u,i[a]),R}let p=i;return {...p,[a]:t(d,u,p[a])}};return t(n,e,r)}}}function ze(n){return {get:e=>e[n],set:(e,r)=>{let t=[...r];return t[n]=e,t}}}function He(n,e){return e===void 0?r=>n.get(r):n.get(e)}function $e(n,e,r){return e===void 0?(t,o)=>o===void 0?u=>n.set(t,u):n.set(t,o):r===void 0?t=>n.set(e,t):n.set(e,r)}function Ye(n,e,r){return e===void 0?(t,o)=>o===void 0?u=>n.set(t(n.get(u)),u):n.set(t(n.get(o)),o):r===void 0?t=>n.set(e(n.get(t)),t):n.set(e(n.get(r)),r)}function Ge(n,e){return e===void 0?r=>Promise.all(r.map((t,o)=>n(t,o))):Promise.all(e.map((r,t)=>n(r,t)))}function Je(n,e){let r=async t=>{let o=[];for(let u=0;u<t.length;u++)o.push(await n(t[u],u));return o};return e===void 0?t=>r(t):r(e)}function Qe(n,e){let r=async t=>(await Promise.all(t.map(async(u,i)=>({item:u,keep:await n(u,i)})))).filter(({keep:u})=>u).map(({item:u})=>u);return e===void 0?t=>r(t):r(e)}function Xe(n,e,r){let t=async o=>{let u=e;for(let i=0;i<o.length;i++)u=await n(u,o[i],i);return u};return r===void 0?o=>t(o):t(r)}var b="@@transducer/init",m="@@transducer/step",x="@@transducer/result";function Ze(n){return e=>({[b]:()=>e[b](),[m]:(r,t)=>e[m](r,n(t)),[x]:r=>e[x](r)})}function nr(n){return e=>({[b]:()=>e[b](),[m]:(r,t)=>n(t)?e[m](r,t):r,[x]:r=>e[x](r)})}function er(n){return e=>{let r=0;return {[b]:()=>e[b](),[m]:(t,o)=>r<n?(r++,e[m](t,o)):t,[x]:t=>e[x](t)}}}function rr(n){return e=>{let r=0;return {[b]:()=>e[b](),[m]:(t,o)=>r<n?(r++,t):e[m](t,o),[x]:t=>e[x](t)}}}function tr(...n){return e=>n.reduceRight((r,t)=>t(r),e)}function Mr(){return {[b]:()=>[],[m]:(n,e)=>(n.push(e),n),[x]:n=>n}}function or(n,e,r,t){let o=u=>{let i=n(e),a=r;for(let d of u)a=i[m](a,d);return i[x](a)};return t===void 0?u=>o(u):o(t)}function ur(n,e){let r=t=>{let o=n(Mr()),u=o[b]();for(let i of t)u=o[m](u,i);return o[x](u)};return e===void 0?t=>r(t):r(e)}var Go={identity:C,always:S,T:K,F:B,tap:v,curry:E,curryN:F,partial:V,partialRight:j,pipe:D,pipeBuilder:N,compose:O,pipeWith:L,pipeAsync:W,composeAsync:q,pipeK:I,composeK:_,letIn:z,map:H,filter:$,reject:Y,reduce:G,reduceRight:J,head:Q,tail:X,last:Z,init:nn,nth:en,take:rn,takeLast:tn,takeWhile:on,drop:un,dropLast:an,dropWhile:dn,slice:sn,find:cn,findIndex:ln,findLast:fn,indexOf:pn,includes:Tn,flatten:A,unnest:yn,chain:mn,uniq:xn,uniqBy:bn,sort:gn,sortBy:Rn,reverse:kn,groupBy:hn,concat:An,append:wn,prepend:Un,zip:Cn,zipWith:Sn,zipObj:Kn,some:Bn,every:Pn,none:vn,length:En,sum:Fn,product:Vn,mean:jn,median:Dn,min:Nn,max:On,countBy:Ln,range:Wn,partition:qn,splitEvery:In,indexBy:_n,prop:Mn,path:f,propOr:zn,pathOr:Hn,props:$n,pluck:Yn,assoc:Jn,assocPath:Qn,dissoc:Xn,dissocPath:Zn,pick:ne,omit:ee,merge:re,mergeDeep:te,evolve:oe,applySpec:ue,extend:ie,keys:ae,values:de,entries:se,fromEntries:ce,equals:T,identical:fe,gt:pe,gte:Te,lt:ye,lte:me,not:xe,and:be,or:ge,both:Re,either:ke,complement:he,allPass:Ae,anyPass:we,ifElse:Ue,when:Ce,unless:Se,cond:Ke,tryCatch:Be,propEq:Pe,propSatisfies:ve,pathEq:Ee,pathSatisfies:Fe,where:Ve,whereEq:je,is:De,isNil:Ne,isEmpty:U,isNotNil:Oe,isNotEmpty:Le,defaultTo:We,coalesce:qe,add:ir,subtract:ar,multiply:dr,divide:sr,modulo:cr,mathMod:lr,negate:fr,inc:pr,dec:Tr,clamp:yr,abs:mr,round:xr,floor:br,ceil:gr,pow:Rr,toUpper:kr,toLower:hr,trim:Ar,split:wr,join:Ur,replace:Cr,startsWith:Sr,endsWith:Kr,test:Br,match:Pr,substring:vr,padStart:Er,padEnd:Fr,concatStr:Vr,toString:jr,toNumber:Dr,toBoolean:Nr,toArray:Or,toObject:Lr,type:Wr,lens:Ie,lensProp:_e,lensPath:Me,lensIndex:ze,view:He,set:$e,over:Ye,mapAsync:Ge,mapSerial:Je,filterAsync:Qe,reduceAsync:Xe,mapT:Ze,filterT:nr,takeT:er,dropT:rr,composeT:tr,transduce:or,into:ur};export{B as F,K as T,Ir as __,mr as abs,ir as add,Ae as allPass,S as always,be as and,we as anyPass,wn as append,ue as applySpec,Jn as assoc,Qn as assocPath,Re as both,gr as ceil,mn as chain,yr as clamp,qe as coalesce,he as complement,O as compose,q as composeAsync,_ as composeK,tr as composeT,An as concat,Vr as concatStr,Ke as cond,Ln as countBy,E as curry,F as curryN,Tr as dec,We as defaultTo,Xn as dissoc,Zn as dissocPath,sr as divide,un as drop,an as dropLast,rr as dropT,dn as dropWhile,ke as either,Kr as endsWith,se as entries,T as equals,Pn as every,oe as evolve,ie as extend,$ as filter,Qe as filterAsync,nr as filterT,cn as find,ln as findIndex,fn as findLast,A as flatten,br as floor,ce as fromEntries,hn as groupBy,pe as gt,Te as gte,Q as head,fe as identical,C as identity,Ue as ifElse,pr as inc,Tn as includes,_n as indexBy,pn as indexOf,nn as init,ur as into,De as is,U as isEmpty,Ne as isNil,Le as isNotEmpty,Oe as isNotNil,c as isPlaceholder,Ur as join,ae as keys,Z as last,En as length,Ie as lens,ze as lensIndex,Me as lensPath,_e as lensProp,z as letIn,ye as lt,me as lte,H as map,Ge as mapAsync,Je as mapSerial,Ze as mapT,Pr as match,lr as mathMod,On as max,jn as mean,Dn as median,re as merge,te as mergeDeep,Nn as min,cr as modulo,dr as multiply,fr as negate,vn as none,xe as not,en as nth,ee as omit,ge as or,Ye as over,Fr as padEnd,Er as padStart,V as partial,j as partialRight,qn as partition,f as path,Ee as pathEq,Hn as pathOr,Fe as pathSatisfies,ne as pick,D as pipe,W as pipeAsync,N as pipeBuilder,I as pipeK,L as pipeWith,Yn as pluck,Rr as pow,Un as prepend,Vn as product,Mn as prop,Pe as propEq,zn as propOr,ve as propSatisfies,$n as props,Wn as range,G as reduce,Xe as reduceAsync,J as reduceRight,Y as reject,Cr as replace,kn as reverse,xr as round,Go as scope,$e as set,sn as slice,Bn as some,gn as sort,Rn as sortBy,wr as split,In as splitEvery,Sr as startsWith,vr as substring,ar as subtract,Fn as sum,X as tail,rn as take,tn as takeLast,er as takeT,on as takeWhile,v as tap,Br as test,Or as toArray,Nr as toBoolean,hr as toLower,Dr as toNumber,Lr as toObject,jr as toString,kr as toUpper,or as transduce,Ar as trim,Be as tryCatch,Wr as type,xn as uniq,bn as uniqBy,Se as unless,yn as unnest,de as values,He as view,Ce as when,Ve as where,je as whereEq,Cn as zip,Kn as zipObj,Sn as zipWith};
|
package/package.json
CHANGED