pepka 0.14.0-beta9 → 0.14.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/dist/bundle.cjs +1 -1
- package/dist/bundle.d.ts +74 -151
- package/dist/bundle.mjs +1 -1
- package/dts-fix.js +5 -8
- package/package.json +12 -10
- package/src/curry.ts +8 -9
- package/src/quick.ts +1 -1
- package/src/safe.ts +43 -13
- package/src/uncurry.ts +1 -1
package/dist/bundle.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=Symbol("Placeholder"),r=r=>{let t=0;for(const s of r)s!==e&&t++;return t},t=(r,t)=>{const s=r.length,o=r.slice(),p=t.length;let n=p,c=0;for(;n&&c<s;c++)o[c]===e&&(o[c]=t[p-n],n--);for(c=s;n;c++,n--)o[c]=t[p-n];return o},s=(e,o,p)=>{const n=e.length-o.length-r(p);if(n<1)return e(...t(o,p));{const r=(...r)=>s(e,t(o,p),r);return r.$args_left=n,r}},o=e=>(...t)=>e.length>r(t)?s(e,[],t):e(...t),p=r=>function(t){return t===e?r:r(t)};function n(r){return function(t,s){const o=t===e,n=arguments.length;if(1===n&&o)throw new Error("Senseless placeholder usage.");return arguments.length>1?o?p((e=>r(e,s))):r(t,s):e=>r(t,e)}}function c(e){return o(e)}const x=void 0,a=1/0,i=e=>typeof e,l=e=>null===e,u=e=>"number"==i(e),f=e=>Array.isArray(e),h=e=>"function"===i(e),d={u:"U",b:"B",n:"N",s:"S",f:"F"},m=e=>{const r=i(e);return"object"===r?l(e)?"Null":e.constructor.name:d[r[0]]+r.slice(1)},y=n(((e,r)=>m(r)===e)),g=n(((e,r)=>(r.push(e),r))),b=c(((e,r,t)=>(t[e]=r,t))),w=c(((e,r,t)=>t.reduce(e,r))),j=c(((e,r,t)=>{for(let s in t)switch(m(t[s])){case"Array":if(e>1&&"Array"===m(r[s]))switch(e){case 2:const o=r[s],p=t[s];for(const r in p)o[r]?j(e,o[r],p[r]):o[r]=p[r];break;case 3:r[s].push(...t[s])}else r[s]=t[s];break;case"Object":if("Object"===m(r[s])){j(e,r[s],t[s]);break}default:r[s]=t[s]}return r})),O=j(1),q=j(2),A=j(3),E=n(((e,r)=>{let t,s,o,p;for(t in e)s=e[t],[o,p]=h(s)?s(r):[s,r[t]],r[o]=p,t!==o&&delete r[t];return r})),k=n(((e,r)=>{const t=f(r);for(let s in r)e(r[s],s)||(t?r.splice(s,1):delete r[s]);return r})),S=n(((e,r)=>r.indexOf(e))),v=e=>(...r)=>r[e],P=n(((e,r)=>{const t=m(e);if(t===m(r)&&("Object"===t||"Array"==t)){if(l(e)||l(r))return e===r;if(e===r)return!0;for(const t of[e,r])for(const s in t)if(!(t===r&&s in e||t===e&&s in r&&P(e[s],r[s])))return!1;return!0}return e===r})),D=o(((e,r,t,s)=>e(s)?r(s):t(s))),
|
|
1
|
+
"use strict";const e=Symbol("Placeholder"),r=r=>{let t=0;for(const s of r)s!==e&&t++;return t},t=(r,t)=>{const s=r.length,o=r.slice(),p=t.length;let n=p,c=0;for(;n&&c<s;c++)o[c]===e&&(o[c]=t[p-n],n--);for(c=s;n;c++,n--)o[c]=t[p-n];return o},s=(e,o,p)=>{const n=e.length-o.length-r(p);if(n<1)return e(...t(o,p));{const r=(...r)=>s(e,t(o,p),r);return r.$args_left=n,r}},o=e=>(...t)=>e.length>r(t)?s(e,[],t):e(...t),p=r=>function(t){return t===e?r:r(t)};function n(r){return function(t,s){const o=t===e,n=arguments.length;if(1===n&&o)throw new Error("Senseless placeholder usage.");return arguments.length>1?o?p((e=>r(e,s))):r(t,s):e=>r(t,e)}}function c(e){return o(e)}const x=void 0,a=1/0,i=e=>typeof e,l=e=>null===e,u=e=>"number"==i(e),f=e=>Array.isArray(e),h=e=>"function"===i(e),d={u:"U",b:"B",n:"N",s:"S",f:"F"},m=e=>{const r=i(e);return"object"===r?l(e)?"Null":e.constructor.name:d[r[0]]+r.slice(1)},y=n(((e,r)=>m(r)===e)),g=n(((e,r)=>(r.push(e),r))),b=c(((e,r,t)=>(t[e]=r,t))),w=c(((e,r,t)=>t.reduce(e,r))),j=c(((e,r,t)=>{for(let s in t)switch(m(t[s])){case"Array":if(e>1&&"Array"===m(r[s]))switch(e){case 2:const o=r[s],p=t[s];for(const r in p)o[r]?j(e,o[r],p[r]):o[r]=p[r];break;case 3:r[s].push(...t[s])}else r[s]=t[s];break;case"Object":if("Object"===m(r[s])){j(e,r[s],t[s]);break}default:r[s]=t[s]}return r})),O=j(1),q=j(2),A=j(3),E=n(((e,r)=>{let t,s,o,p;for(t in e)s=e[t],[o,p]=h(s)?s(r):[s,r[t]],r[o]=p,t!==o&&delete r[t];return r})),k=n(((e,r)=>{const t=f(r);for(let s in r)e(r[s],s)||(t?r.splice(s,1):delete r[s]);return r})),S=n(((e,r)=>r.indexOf(e))),v=e=>(...r)=>r[e],P=n(((e,r)=>{const t=m(e);if(t===m(r)&&("Object"===t||"Array"==t)){if(l(e)||l(r))return e===r;if(e===r)return!0;for(const t of[e,r])for(const s in t)if(!(t===r&&s in e||t===e&&s in r&&P(e[s],r[s])))return!1;return!0}return e===r})),D=o(((e,r,t,s)=>e(s)?r(s):t(s))),z=c(((e,r,t)=>D(e,r,J,t))),N=(...r)=>(...t)=>{let s,o=!0;for(let p=G(r)-1;p>-1;p--)o?(o=!1,s=r[p](...t)):s=s===e?r[p]():r[p](s);return s},B=n(((e,r)=>e.bind(r))),_=n(((e,r)=>r[e])),C=n(((e,r)=>{if((e=>"string"===i(e))(r))return r.includes(e);for(const t of r)if(P(t,e))return!0;return!1})),I=c(((e,r,t)=>t.slice(e,u(r)?r:a))),T=e=>n(((r,t)=>e(t,r))),U=_(0),$=I(1,a),F=n(((e,r)=>e+r)),K=n(((e,r)=>r-e)),L=n(((e,r)=>e*r)),W=n(((e,r)=>e/r)),X=e=>l(e)||(e=>e===x)(e),G=e=>e.length,H=e=>()=>e,J=e=>e,M=e=>!e,Q=e=>(...r)=>{const t=e(...r);return h(t)&&t.$args_left?Q(t):M(t)},R=e=>Object.entries(e),V=n(((e,r)=>e.test(r))),Y=n(((e,r)=>(e(r),r))),Z=n(((e,r)=>[...r,e])),ee=n(((e,r)=>r.split(e))),re=H(!0),te=H(!1),se=n(((e,r)=>r(...e))),oe=n(((e,r)=>ne(F(e),r-e))),pe=n(((e,r)=>e.filter(T(C)(r)))),ne=n(((e,r)=>[...Array(r)].map(((r,t)=>e(t))))),ce=n(((e,r)=>e>r)),xe=n(((e,r)=>e<r)),ae=n(((e,r)=>r>=e)),ie=n(((e,r)=>r<=e)),le=n(((e,r)=>r.sort(e))),ue=n(((e,r)=>r.find(e))),fe=n(((e,r)=>r.findIndex(e))),he=n(((e,r)=>fe(P(e),r))),de=n(((e,r)=>{for(const[t,s]of e)if(t(r))return s(r)})),me=c(((e,r,t)=>({...t,[e]:r}))),ye=c(((e,r,t)=>N((s=>{return me(s,G(e)<2?r:ye(I(1,a,e),r,(o=t[s],l(o)||"object"!==i(o)?{}:t[s])),t);var o}),U)(e))),ge=n(((e,r)=>r.every(e))),be=n(((e,r)=>r.some(e))),we=n(((e,r)=>e.every((e=>e(r))))),je=n(((e,r)=>e.some((e=>e(r))))),Oe=n(((e,r)=>r[e])),qe=c(((e,r,t)=>P(t[e],r))),Ae=c(((e,r,t)=>P(r[e],t[e]))),Ee=c(((e,r,t)=>D(G,(()=>X(t)?e:N(D(X,H(e),(t=>Ee(e,I(1,a,r),t))),T(Oe)(t),U)(r)),H(t),r))),ke=Ee(x),Se=c(((e,r,t)=>P(ke(e,t),r))),ve=c(((e,r,t)=>P(ke(e,r),ke(e,t)))),Pe=/^(.*?)(8|16|32|64)(Clamped)?Array$/,De=(e,r=!1)=>{const t=m(e);switch(t){case"Null":case"String":case"Number":case"Boolean":case"Symbol":return e;case"Array":return r?[...e]:Ue(N(De,v(0)),e);case"Object":if(r)return{...e};const s={};for(let r in e)s[r]=De(e[r]);return s;default:return Pe.test(t)?e.constructor.from(e):e}},ze=c(((e,r,t)=>w(e,De(r),t))),Ne=n(((e,r)=>Le(e,r))),Be=n(((e,r)=>{const t={};for(const s of e)s in r&&(t[s]=r[s]);return t})),_e=n(((e,r)=>Le(((r,t)=>!C(t,e)),r))),Ce=e=>ze(((e,r)=>me(...r,e)),{},e),Ie=n(((e,r)=>r.concat(e))),Te=n(((e,r)=>r.join(e))),Ue=n(((e,r)=>r.map(e))),$e=n(((e,r)=>r.forEach(e))),Fe=c(((e,r,t)=>r(t)&&e(t))),Ke=c(((e,r,t)=>t.replace(e,r))),Le=n(((e,r)=>f(r)?r.filter(e):N(Ce,Le((([r,t])=>e(t,r))),R)(r))),We=n(((e,r)=>Object.assign({},e,r))),Xe=n(((e,r)=>O(De(e),De(r)))),Ge=n(((e,r)=>q(De(e),De(r)))),He=n(((e,r)=>A(De(e),De(r)))),Je=c(((e,r,t)=>me(e,r(t[e]),t))),Me=n(((e,r)=>E(e,Object.assign({},r)))),Qe=n(((e,r)=>Ue(((e,t)=>[e,r[t]]),e))),Re=n(((e,r)=>ze(((e,t,s)=>me(t,r[s],e)),{},e))),Ve=c(((e,r,t)=>Ue(((r,s)=>e(r,t[s])),r))),Ye=(()=>{const e=async(r,t,s)=>{s<t.length&&(await r(t[s]),await e(r,t,++s))};return n(((r,t)=>e(r,t,0)))})(),Ze=n((async(e,r)=>(await e(r),r))),er=n(((e,r)=>Promise.all(r.map(e)))),rr=(()=>{const e=async(r,t,s)=>~s?await e(r,await r[s](t),--s):t;return(...r)=>t=>e(r,t,r.length-1)})(),tr=J,sr=J,or=J,pr=Q;exports.F=te,exports.T=re,exports.__=e,exports.add=F,exports.all=ge,exports.allPass=we,exports.always=H,exports.any=be,exports.anyPass=je,exports.append=Z,exports.assoc=me,exports.assocPath=ye,exports.bind=B,exports.both=Fe,exports.callWith=se,exports.clone=De,exports.cloneShallow=e=>De(e,!0),exports.complement=Q,exports.compose=N,exports.composeAsync=rr,exports.concat=Ie,exports.cond=de,exports.curry=o,exports.curry2=n,exports.curry3=c,exports.divide=W,exports.echo=or,exports.empty=e=>{switch(m(e)){case"String":return"";case"Object":return{};case"Array":return[];default:return x}},exports.equals=P,exports.explore=(e,r="log")=>Y((t=>console[r](e,t))),exports.filter=Le,exports.find=ue,exports.findIndex=fe,exports.flip=T,exports.forEach=$e,exports.forEachAsync=er,exports.forEachSerial=Ye,exports.fromPairs=Ce,exports.genBy=ne,exports.getTmpl=e=>{const r=[],t=[],s=e.length;let o,p,n,c=0,x=0,a=!1,i=U(e),l=!1;for(c=0;c<s;c++)switch(o=e[c],o){case"{":if(!i){a=!0,x=c;break}case"}":if(!i){a=!1,r.push(""),t.push(e.slice(x+1,c));break}default:n=e[c+1],l="\\"===o,a||l&&("{"===n||"}"===n)||(p=r.length-1,p<0&&(r.push(""),p++),r[p]+=o),i=l}return e=>{const s=[],o=r.length-1;for(const p in r)c=+p,s.push(r[c]),c!==o&&s.push(ke(t[c].split("."),e));return s.join("")}},exports.gt=ce,exports.gte=ae,exports.head=U,exports.identity=J,exports.ifElse=D,exports.includes=C,exports.indexOf=he,exports.intersection=pe,exports.isEmpty=e=>{switch(m(e)){case"String":case"Array":return 0==G(e);case"Object":for(const r in e)return!1;return!0;default:return null}},exports.isNil=X,exports.join=Te,exports.keys=e=>Object.keys(e),exports.last=e=>e[G(e)-1],exports.length=G,exports.lt=xe,exports.lte=ie,exports.map=Ue,exports.mapKeys=Me,exports.memoize=e=>{let r,t=!1;return()=>t?r:(t=!0,r=e())},exports.mergeDeep=Xe,exports.mergeDeepAdd=He,exports.mergeDeepX=Ge,exports.mergeShallow=We,exports.mirror=tr,exports.multiply=L,exports.noop=(...e)=>{},exports.not=M,exports.notf=pr,exports.nth=_,exports.omit=_e,exports.once=e=>{let r,t=!1;return(...s)=>t?r:(t=!0,r=e(...s))},exports.overProp=Je,exports.path=ke,exports.pathEq=Se,exports.pathOr=Ee,exports.pathsEq=ve,exports.pick=Be,exports.pickBy=Ne,exports.prop=Oe,exports.propEq=qe,exports.propsEq=Ae,exports.qappend=g,exports.qassoc=b,exports.qfilter=k,exports.qindexOf=S,exports.qmapKeys=E,exports.qmergeDeep=O,exports.qmergeDeepAdd=A,exports.qmergeDeepX=q,exports.qreduce=w,exports.range=oe,exports.reduce=ze,exports.reflect=sr,exports.replace=Ke,exports.reverse=e=>N((r=>ze(((t,s,o)=>g(e[r-o],t)),[],e)),F(-1),G)(e),exports.sizeof=e=>{if("Object"===m(e)){let r=0;for(let t in e)r++;return r}return G(e)},exports.slice=I,exports.sort=le,exports.split=ee,exports.subtract=K,exports.tail=$,exports.take=v,exports.tap=Y,exports.test=V,exports.toLower=e=>e.toLowerCase(),exports.toPairs=R,exports.toUpper=e=>e.toUpperCase(),exports.trim=e=>e.trim(),exports.type=m,exports.typeIs=y,exports.uncurry=e=>(...r)=>w(((e,r)=>e?e(r):e),e,r),exports.uniq=e=>w(((e,r)=>C(r,e)?e:g(r,e)),[],e),exports.values=e=>Object.values(e),exports.waitAll=e=>Promise.all(e),exports.waitTap=Ze,exports.when=z,exports.zip=Qe,exports.zipObj=Re,exports.zipWith=Ve;
|
package/dist/bundle.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import {F as FT} from 'ts-toolbelt'
|
|
2
1
|
export { __ }
|
|
3
2
|
|
|
4
3
|
// Generated by dts-bundle-generator v7.1.0
|
|
@@ -9,11 +8,10 @@ export interface AnyObject {
|
|
|
9
8
|
}
|
|
10
9
|
export type AnyArgs = any[];
|
|
11
10
|
export type Curried<Args extends AnyArgs = AnyArgs, ReturnT = any> = (arg: Args[number]) => Curried<Args> | ReturnT;
|
|
12
|
-
export type Reducer<T = any> = (accum: T, cur: any, index: number) => T;
|
|
13
11
|
export type AnyFunc<ReturnT = any, Args extends AnyArgs = AnyArgs> = (...args: Args) => ReturnT;
|
|
14
12
|
export type Placeholder = symbol;
|
|
15
13
|
declare const __: Placeholder;
|
|
16
|
-
export declare const curry:
|
|
14
|
+
export declare const curry: (fn: AnyFunc) => (...args: AnyArgs) => any;
|
|
17
15
|
export type Func2 = (a: any, b: any) => any;
|
|
18
16
|
export declare function curry2<Func extends Func2>(fn: Func): {
|
|
19
17
|
(a: Placeholder, b: Parameters<Func>[1]): (a: Parameters<Func>[0]) => ReturnType<Func>;
|
|
@@ -22,7 +20,7 @@ export declare function curry2<Func extends Func2>(fn: Func): {
|
|
|
22
20
|
(a: Parameters<Func>[0], b: Parameters<Func>[1]): ReturnType<Func>;
|
|
23
21
|
};
|
|
24
22
|
export type Func3 = (a: any, b: any, c: any) => any;
|
|
25
|
-
export declare function curry3<Func extends Func3>(fn: Func):
|
|
23
|
+
export declare function curry3<Func extends Func3>(fn: Func): (...args: AnyArgs) => any;
|
|
26
24
|
export declare const uncurry: <Args extends any[] = any[], ReturnT = any>(fn: Curried<Args, any>) => AnyFunc;
|
|
27
25
|
export declare const toLower: (s: string) => string;
|
|
28
26
|
export declare const toUpper: (s: string) => string;
|
|
@@ -40,8 +38,8 @@ export declare const equals: {
|
|
|
40
38
|
(a: any): (b: any) => boolean;
|
|
41
39
|
(a: any, b: any): boolean;
|
|
42
40
|
};
|
|
43
|
-
export declare const ifElse:
|
|
44
|
-
export declare const when:
|
|
41
|
+
export declare const ifElse: (...args: AnyArgs) => any;
|
|
42
|
+
export declare const when: (...args: AnyArgs) => any;
|
|
45
43
|
export type Composed<TIn extends any[], TOut> = (...xs: TIn) => TOut;
|
|
46
44
|
export declare const compose: <TIn extends any[] = any[], TOut = any>(...fns: AnyFunc[]) => Composed<TIn, TOut>;
|
|
47
45
|
export declare const bind: {
|
|
@@ -62,15 +60,15 @@ export declare const includes: {
|
|
|
62
60
|
(a: unknown): (b: unknown[]) => boolean;
|
|
63
61
|
(a: unknown, b: unknown[]): boolean;
|
|
64
62
|
};
|
|
65
|
-
export declare const slice:
|
|
63
|
+
export declare const slice: (...args: AnyArgs) => any;
|
|
66
64
|
export declare const flip: <T extends AnyFunc<any, AnyArgs>>(fn: T) => {
|
|
67
65
|
(a: symbol, b: Parameters<T>[0]): (a: Parameters<T>[1]) => any;
|
|
68
66
|
(a: Parameters<T>[1], b: symbol): (b: Parameters<T>[0]) => any;
|
|
69
67
|
(a: Parameters<T>[1]): (b: Parameters<T>[0]) => any;
|
|
70
68
|
(a: Parameters<T>[1], b: Parameters<T>[0]): any;
|
|
71
69
|
};
|
|
72
|
-
export declare const head: (
|
|
73
|
-
export declare const tail:
|
|
70
|
+
export declare const head: <T = any>(xs: string | T[]) => T;
|
|
71
|
+
export declare const tail: any;
|
|
74
72
|
export declare const add: {
|
|
75
73
|
(a: symbol, b: number): (a: number) => number;
|
|
76
74
|
(a: number, b: symbol): (b: number) => number;
|
|
@@ -135,6 +133,13 @@ export declare const split: {
|
|
|
135
133
|
};
|
|
136
134
|
export declare const T: (...args: any[]) => true;
|
|
137
135
|
export declare const F: (...args: any[]) => false;
|
|
136
|
+
export declare const callWith: {
|
|
137
|
+
(a: symbol, b: AnyFunc<any, AnyArgs>): (a: any[]) => any;
|
|
138
|
+
(a: any[], b: symbol): (b: AnyFunc<any, AnyArgs>) => any;
|
|
139
|
+
(a: any[]): (b: AnyFunc<any, AnyArgs>) => any;
|
|
140
|
+
(a: any[], b: AnyFunc<any, AnyArgs>): any;
|
|
141
|
+
};
|
|
142
|
+
export declare const noop: (..._args: any[]) => void;
|
|
138
143
|
export declare const sizeof: (s: any[] | string | AnyObject) => number;
|
|
139
144
|
export declare const range: {
|
|
140
145
|
(a: symbol, b: number): (a: number) => any[];
|
|
@@ -224,9 +229,12 @@ export declare const cond: {
|
|
|
224
229
|
Function
|
|
225
230
|
][], b: any): any;
|
|
226
231
|
};
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
232
|
+
/** Assigns a prop to an object.
|
|
233
|
+
* @param prop string
|
|
234
|
+
* @param value any
|
|
235
|
+
* @param object AnyObject
|
|
236
|
+
*/
|
|
237
|
+
export declare const assoc: (...args: AnyArgs) => any;
|
|
230
238
|
export declare const assocPath: any;
|
|
231
239
|
export declare const all: {
|
|
232
240
|
(a: symbol, b: any[]): (a: Cond) => boolean;
|
|
@@ -258,18 +266,20 @@ export declare const prop: {
|
|
|
258
266
|
(a: string): (b: AnyObject) => any;
|
|
259
267
|
(a: string, b: AnyObject): any;
|
|
260
268
|
};
|
|
261
|
-
export declare const propEq:
|
|
262
|
-
export declare const propsEq:
|
|
263
|
-
export declare const pathOr:
|
|
264
|
-
export declare const path:
|
|
265
|
-
export declare const pathEq:
|
|
266
|
-
export declare const pathsEq:
|
|
269
|
+
export declare const propEq: (...args: AnyArgs) => any;
|
|
270
|
+
export declare const propsEq: (...args: AnyArgs) => any;
|
|
271
|
+
export declare const pathOr: (...args: AnyArgs) => any;
|
|
272
|
+
export declare const path: any;
|
|
273
|
+
export declare const pathEq: (...args: AnyArgs) => any;
|
|
274
|
+
export declare const pathsEq: (...args: AnyArgs) => any;
|
|
267
275
|
export declare const clone: (s: any, shallow?: boolean) => any;
|
|
268
276
|
export declare const cloneShallow: (s: any) => any;
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
277
|
+
/** types T1, T2
|
|
278
|
+
* @param reducer (accum: T1, current: T2, index: number) => newAccum: T1
|
|
279
|
+
* @param accum T1
|
|
280
|
+
* @param array T2[]
|
|
281
|
+
*/
|
|
282
|
+
export declare const reduce: (...args: AnyArgs) => any;
|
|
273
283
|
export declare const pickBy: {
|
|
274
284
|
(a: symbol, b: AnyObject): (a: Cond) => any;
|
|
275
285
|
(a: Cond, b: symbol): (b: AnyObject) => any;
|
|
@@ -291,10 +301,7 @@ export declare const omit: {
|
|
|
291
301
|
export declare const fromPairs: (pairs: [
|
|
292
302
|
string,
|
|
293
303
|
any
|
|
294
|
-
][]) =>
|
|
295
|
-
] | [
|
|
296
|
-
accum: any
|
|
297
|
-
]) => any>>;
|
|
304
|
+
][]) => any;
|
|
298
305
|
export declare const concat: {
|
|
299
306
|
(a: symbol, b: string | any[]): (a: string | any[]) => string | any[];
|
|
300
307
|
(a: string | any[], b: symbol): (b: string | any[]) => string | any[];
|
|
@@ -319,10 +326,10 @@ export declare const forEach: {
|
|
|
319
326
|
(a: (s: any) => any): (b: any[]) => void;
|
|
320
327
|
(a: (s: any) => any, b: any[]): void;
|
|
321
328
|
};
|
|
322
|
-
export declare const both:
|
|
329
|
+
export declare const both: (...args: AnyArgs) => any;
|
|
323
330
|
export declare const isEmpty: (s: any) => boolean | null;
|
|
324
331
|
export declare const empty: (s: any) => {} | undefined;
|
|
325
|
-
export declare const replace:
|
|
332
|
+
export declare const replace: (...args: AnyArgs) => any;
|
|
326
333
|
export declare const filter: any;
|
|
327
334
|
export declare const memoize: (fn: Function) => () => any;
|
|
328
335
|
export declare const mergeShallow: {
|
|
@@ -332,128 +339,24 @@ export declare const mergeShallow: {
|
|
|
332
339
|
(a: AnyObject, b: AnyObject): AnyObject;
|
|
333
340
|
};
|
|
334
341
|
export declare const mergeDeep: {
|
|
335
|
-
(a: symbol, b: AnyObject): (a: AnyObject) =>
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
] | [
|
|
340
|
-
o2: AnyObject
|
|
341
|
-
] | [
|
|
342
|
-
o1: AnyObject
|
|
343
|
-
]) => any>;
|
|
344
|
-
(a: AnyObject, b: symbol): (b: AnyObject) => FT.Curry<(...p: [
|
|
345
|
-
] | [
|
|
346
|
-
o1: AnyObject,
|
|
347
|
-
o2: AnyObject
|
|
348
|
-
] | [
|
|
349
|
-
o2: AnyObject
|
|
350
|
-
] | [
|
|
351
|
-
o1: AnyObject
|
|
352
|
-
]) => any>;
|
|
353
|
-
(a: AnyObject): (b: AnyObject) => FT.Curry<(...p: [
|
|
354
|
-
] | [
|
|
355
|
-
o1: AnyObject,
|
|
356
|
-
o2: AnyObject
|
|
357
|
-
] | [
|
|
358
|
-
o2: AnyObject
|
|
359
|
-
] | [
|
|
360
|
-
o1: AnyObject
|
|
361
|
-
]) => any>;
|
|
362
|
-
(a: AnyObject, b: AnyObject): FT.Curry<(...p: [
|
|
363
|
-
] | [
|
|
364
|
-
o1: AnyObject,
|
|
365
|
-
o2: AnyObject
|
|
366
|
-
] | [
|
|
367
|
-
o2: AnyObject
|
|
368
|
-
] | [
|
|
369
|
-
o1: AnyObject
|
|
370
|
-
]) => any>;
|
|
342
|
+
(a: symbol, b: AnyObject): (a: AnyObject) => AnyObject;
|
|
343
|
+
(a: AnyObject, b: symbol): (b: AnyObject) => AnyObject;
|
|
344
|
+
(a: AnyObject): (b: AnyObject) => AnyObject;
|
|
345
|
+
(a: AnyObject, b: AnyObject): AnyObject;
|
|
371
346
|
};
|
|
372
347
|
export declare const mergeDeepX: {
|
|
373
|
-
(a: symbol, b: AnyObject): (a: AnyObject) =>
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
] | [
|
|
378
|
-
o2: AnyObject
|
|
379
|
-
] | [
|
|
380
|
-
o1: AnyObject
|
|
381
|
-
]) => any>;
|
|
382
|
-
(a: AnyObject, b: symbol): (b: AnyObject) => FT.Curry<(...p: [
|
|
383
|
-
] | [
|
|
384
|
-
o1: AnyObject,
|
|
385
|
-
o2: AnyObject
|
|
386
|
-
] | [
|
|
387
|
-
o2: AnyObject
|
|
388
|
-
] | [
|
|
389
|
-
o1: AnyObject
|
|
390
|
-
]) => any>;
|
|
391
|
-
(a: AnyObject): (b: AnyObject) => FT.Curry<(...p: [
|
|
392
|
-
] | [
|
|
393
|
-
o1: AnyObject,
|
|
394
|
-
o2: AnyObject
|
|
395
|
-
] | [
|
|
396
|
-
o2: AnyObject
|
|
397
|
-
] | [
|
|
398
|
-
o1: AnyObject
|
|
399
|
-
]) => any>;
|
|
400
|
-
(a: AnyObject, b: AnyObject): FT.Curry<(...p: [
|
|
401
|
-
] | [
|
|
402
|
-
o1: AnyObject,
|
|
403
|
-
o2: AnyObject
|
|
404
|
-
] | [
|
|
405
|
-
o2: AnyObject
|
|
406
|
-
] | [
|
|
407
|
-
o1: AnyObject
|
|
408
|
-
]) => any>;
|
|
348
|
+
(a: symbol, b: AnyObject): (a: AnyObject) => AnyObject;
|
|
349
|
+
(a: AnyObject, b: symbol): (b: AnyObject) => AnyObject;
|
|
350
|
+
(a: AnyObject): (b: AnyObject) => AnyObject;
|
|
351
|
+
(a: AnyObject, b: AnyObject): AnyObject;
|
|
409
352
|
};
|
|
410
353
|
export declare const mergeDeepAdd: {
|
|
411
|
-
(a: symbol, b: AnyObject): (a: AnyObject) =>
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
] | [
|
|
418
|
-
o1: AnyObject
|
|
419
|
-
]) => any>;
|
|
420
|
-
(a: AnyObject, b: symbol): (b: AnyObject) => FT.Curry<(...p: [
|
|
421
|
-
] | [
|
|
422
|
-
o1: AnyObject,
|
|
423
|
-
o2: AnyObject
|
|
424
|
-
] | [
|
|
425
|
-
o2: AnyObject
|
|
426
|
-
] | [
|
|
427
|
-
o1: AnyObject
|
|
428
|
-
]) => any>;
|
|
429
|
-
(a: AnyObject): (b: AnyObject) => FT.Curry<(...p: [
|
|
430
|
-
] | [
|
|
431
|
-
o1: AnyObject,
|
|
432
|
-
o2: AnyObject
|
|
433
|
-
] | [
|
|
434
|
-
o2: AnyObject
|
|
435
|
-
] | [
|
|
436
|
-
o1: AnyObject
|
|
437
|
-
]) => any>;
|
|
438
|
-
(a: AnyObject, b: AnyObject): FT.Curry<(...p: [
|
|
439
|
-
] | [
|
|
440
|
-
o1: AnyObject,
|
|
441
|
-
o2: AnyObject
|
|
442
|
-
] | [
|
|
443
|
-
o2: AnyObject
|
|
444
|
-
] | [
|
|
445
|
-
o1: AnyObject
|
|
446
|
-
]) => any>;
|
|
447
|
-
};
|
|
448
|
-
export declare const overProp: FT.Curry<(prop: string, pipe: AnyFunc, data: any) => FT.Curry<(...p: [
|
|
449
|
-
] | [
|
|
450
|
-
v: any,
|
|
451
|
-
obj: AnyObject
|
|
452
|
-
] | [
|
|
453
|
-
obj: AnyObject
|
|
454
|
-
] | [
|
|
455
|
-
v: any
|
|
456
|
-
]) => any>>;
|
|
354
|
+
(a: symbol, b: AnyObject): (a: AnyObject) => AnyObject;
|
|
355
|
+
(a: AnyObject, b: symbol): (b: AnyObject) => AnyObject;
|
|
356
|
+
(a: AnyObject): (b: AnyObject) => AnyObject;
|
|
357
|
+
(a: AnyObject, b: AnyObject): AnyObject;
|
|
358
|
+
};
|
|
359
|
+
export declare const overProp: (...args: AnyArgs) => any;
|
|
457
360
|
/** mapKeys({ a: 'b' }, { a: 44 }) -> { b: 44 } */
|
|
458
361
|
export declare const mapKeys: {
|
|
459
362
|
(a: symbol, b: AnyObject): (a: {
|
|
@@ -469,6 +372,25 @@ export declare const mapKeys: {
|
|
|
469
372
|
[oldKey: string]: string;
|
|
470
373
|
}, b: AnyObject): AnyObject;
|
|
471
374
|
};
|
|
375
|
+
export declare const zip: {
|
|
376
|
+
(a: symbol, b: unknown[]): (a: unknown[]) => any[];
|
|
377
|
+
(a: unknown[], b: symbol): (b: unknown[]) => any[];
|
|
378
|
+
(a: unknown[]): (b: unknown[]) => any[];
|
|
379
|
+
(a: unknown[], b: unknown[]): any[];
|
|
380
|
+
};
|
|
381
|
+
export declare const zipObj: {
|
|
382
|
+
(a: symbol, b: unknown[]): (a: unknown[]) => any;
|
|
383
|
+
(a: unknown[], b: symbol): (b: unknown[]) => any;
|
|
384
|
+
(a: unknown[]): (b: unknown[]) => any;
|
|
385
|
+
(a: unknown[], b: unknown[]): any;
|
|
386
|
+
};
|
|
387
|
+
/** zips through a pipe. Types T1, T2, T3.
|
|
388
|
+
* @returns T3[]
|
|
389
|
+
* @param pipe (T1, T2) => T3
|
|
390
|
+
* @param a T1[]
|
|
391
|
+
* @param b T2[]
|
|
392
|
+
*/
|
|
393
|
+
export declare const zipWith: (...args: AnyArgs) => any;
|
|
472
394
|
/** One promise waits for another. */
|
|
473
395
|
export declare const forEachSerial: {
|
|
474
396
|
(a: symbol, b: any[]): (a: AnyFunc<any, AnyArgs>) => Promise<void>;
|
|
@@ -496,17 +418,18 @@ export declare const composeAsync: <T = any>(...fns: AnyFunc[]) => (data?: any)
|
|
|
496
418
|
export declare const mirror: (s: any) => any;
|
|
497
419
|
export declare const reflect: (s: any) => any;
|
|
498
420
|
export declare const echo: (s: any) => any;
|
|
421
|
+
export declare const notf: (fn: AnyFunc) => (...args: any) => boolean | any;
|
|
499
422
|
export declare const qappend: {
|
|
500
423
|
(a: symbol, b: any[]): (a: any) => any[];
|
|
501
424
|
(a: any, b: symbol): (b: any[]) => any[];
|
|
502
425
|
(a: any): (b: any[]) => any[];
|
|
503
426
|
(a: any, b: any[]): any[];
|
|
504
427
|
};
|
|
505
|
-
export declare const qassoc:
|
|
506
|
-
export declare const qreduce:
|
|
507
|
-
export declare const qmergeDeep:
|
|
508
|
-
export declare const qmergeDeepX:
|
|
509
|
-
export declare const qmergeDeepAdd:
|
|
428
|
+
export declare const qassoc: (...args: AnyArgs) => any;
|
|
429
|
+
export declare const qreduce: (...args: AnyArgs) => any;
|
|
430
|
+
export declare const qmergeDeep: any;
|
|
431
|
+
export declare const qmergeDeepX: any;
|
|
432
|
+
export declare const qmergeDeepAdd: any;
|
|
510
433
|
/** qmapKeys({ a: 'b' }, { a: 44 }) -> { b: 44 } */
|
|
511
434
|
export declare const qmapKeys: {
|
|
512
435
|
(a: symbol, b: AnyObject): (a: {
|
package/dist/bundle.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=Symbol("Placeholder"),r=r=>{let t=0;for(const n of r)n!==e&&t++;return t},t=(r,t)=>{const n=r.length,s=r.slice(),c=t.length;let o=c,u=0;for(;o&&u<n;u++)s[u]===e&&(s[u]=t[c-o],o--);for(u=n;o;u++,o--)s[u]=t[c-o];return s},n=(e,s,c)=>{const o=e.length-s.length-r(c);if(o<1)return e(...t(s,c));{const r=(...r)=>n(e,t(s,c),r);return r.$args_left=o,r}},s=e=>(...t)=>e.length>r(t)?n(e,[],t):e(...t),c=r=>function(t){return t===e?r:r(t)};function o(r){return function(t,n){const s=t===e,o=arguments.length;if(1===o&&s)throw new Error("Senseless placeholder usage.");return arguments.length>1?s?c((e=>r(e,n))):r(t,n):e=>r(t,e)}}function u(e){return s(e)}const a=void 0,i=1/0,l=e=>typeof e,f=e=>null===e,h=e=>"number"==l(e),b=e=>Array.isArray(e),g=e=>"function"===l(e),p={u:"U",b:"B",n:"N",s:"S",f:"F"},y=e=>e.toLowerCase(),d=e=>e.toUpperCase(),j=e=>{const r=l(e);return"object"===r?f(e)?"Null":e.constructor.name:p[r[0]]+r.slice(1)},m=o(((e,r)=>j(r)===e)),w=o(((e,r)=>(r.push(e),r))),O=u(((e,r,t)=>(t[e]=r,t))),A=u(((e,r,t)=>t.reduce(e,r))),S=u(((e,r,t)=>{for(let n in t)switch(j(t[n])){case"Array":if(e>1&&"Array"===j(r[n]))switch(e){case 2:const s=r[n],c=t[n];for(const r in c)s[r]?S(e,s[r],c[r]):s[r]=c[r];break;case 3:r[n].push(...t[n])}else r[n]=t[n];break;case"Object":if("Object"===j(r[n])){S(e,r[n],t[n]);break}default:r[n]=t[n]}return r})),k=S(1),v=S(2),N=S(3),x=o(((e,r)=>{let t,n,s,c;for(t in e)n=e[t],[s,c]=g(n)?n(r):[n,r[t]],r[s]=c,t!==s&&delete r[t];return r})),C=o(((e,r)=>{const t=b(r);for(let n in r)e(r[n],n)||(t?r.splice(n,1):delete r[n]);return r})),P=o(((e,r)=>r.indexOf(e))),$=e=>(...r)=>A(((e,r)=>e?e(r):e),e,r),B=e=>(...r)=>r[e],E=o(((e,r)=>{const t=j(e);if(t===j(r)&&("Object"===t||"Array"==t)){if(f(e)||f(r))return e===r;if(e===r)return!0;for(const t of[e,r])for(const n in t)if(!(t===r&&n in e||t===e&&n in r&&E(e[n],r[n])))return!1;return!0}return e===r})),U=s(((e,r,t,n)=>e(n)?r(n):t(n))),_=u(((e,r,t)=>U(e,r,W,t))),F=(...r)=>(...t)=>{let n,s=!0;for(let c=T(r)-1;c>-1;c--)s?(s=!1,n=r[c](...t)):n=n===e?r[c]():r[c](n);return n},I=o(((e,r)=>e.bind(r))),L=o(((e,r)=>r[e])),q=o(((e,r)=>{if((e=>"string"===l(e))(r))return r.includes(e);for(const t of r)if(E(t,e))return!0;return!1})),z=u(((e,r,t)=>t.slice(e,h(r)?r:i))),D=e=>o(((r,t)=>e(t,r))),G=L(0),H=z(1,i),J=o(((e,r)=>e+r)),K=o(((e,r)=>r-e)),M=o(((e,r)=>e*r)),Q=o(((e,r)=>e/r)),R=e=>f(e)||(e=>e===a)(e),T=e=>e.length,V=e=>()=>e,W=e=>e,X=e=>e.trim(),Y=e=>e[T(e)-1],Z=e=>!e,ee=e=>(...r)=>{const t=e(...r);return g(t)&&t.$args_left?ee(t):Z(t)},re=e=>Object.keys(e),te=e=>Object.values(e),ne=e=>Object.entries(e),se=o(((e,r)=>e.test(r))),ce=o(((e,r)=>(e(r),r))),oe=o(((e,r)=>[...r,e])),ue=o(((e,r)=>r.split(e))),ae=V(!0),ie=V(!1),le=e=>{if("Object"===j(e)){let r=0;for(let t in e)r++;return r}return T(e)},
|
|
1
|
+
const e=Symbol("Placeholder"),r=r=>{let t=0;for(const n of r)n!==e&&t++;return t},t=(r,t)=>{const n=r.length,s=r.slice(),c=t.length;let o=c,u=0;for(;o&&u<n;u++)s[u]===e&&(s[u]=t[c-o],o--);for(u=n;o;u++,o--)s[u]=t[c-o];return s},n=(e,s,c)=>{const o=e.length-s.length-r(c);if(o<1)return e(...t(s,c));{const r=(...r)=>n(e,t(s,c),r);return r.$args_left=o,r}},s=e=>(...t)=>e.length>r(t)?n(e,[],t):e(...t),c=r=>function(t){return t===e?r:r(t)};function o(r){return function(t,n){const s=t===e,o=arguments.length;if(1===o&&s)throw new Error("Senseless placeholder usage.");return arguments.length>1?s?c((e=>r(e,n))):r(t,n):e=>r(t,e)}}function u(e){return s(e)}const a=void 0,i=1/0,l=e=>typeof e,f=e=>null===e,h=e=>"number"==l(e),b=e=>Array.isArray(e),g=e=>"function"===l(e),p={u:"U",b:"B",n:"N",s:"S",f:"F"},y=e=>e.toLowerCase(),d=e=>e.toUpperCase(),j=e=>{const r=l(e);return"object"===r?f(e)?"Null":e.constructor.name:p[r[0]]+r.slice(1)},m=o(((e,r)=>j(r)===e)),w=o(((e,r)=>(r.push(e),r))),O=u(((e,r,t)=>(t[e]=r,t))),A=u(((e,r,t)=>t.reduce(e,r))),S=u(((e,r,t)=>{for(let n in t)switch(j(t[n])){case"Array":if(e>1&&"Array"===j(r[n]))switch(e){case 2:const s=r[n],c=t[n];for(const r in c)s[r]?S(e,s[r],c[r]):s[r]=c[r];break;case 3:r[n].push(...t[n])}else r[n]=t[n];break;case"Object":if("Object"===j(r[n])){S(e,r[n],t[n]);break}default:r[n]=t[n]}return r})),k=S(1),v=S(2),N=S(3),x=o(((e,r)=>{let t,n,s,c;for(t in e)n=e[t],[s,c]=g(n)?n(r):[n,r[t]],r[s]=c,t!==s&&delete r[t];return r})),C=o(((e,r)=>{const t=b(r);for(let n in r)e(r[n],n)||(t?r.splice(n,1):delete r[n]);return r})),P=o(((e,r)=>r.indexOf(e))),$=e=>(...r)=>A(((e,r)=>e?e(r):e),e,r),B=e=>(...r)=>r[e],E=o(((e,r)=>{const t=j(e);if(t===j(r)&&("Object"===t||"Array"==t)){if(f(e)||f(r))return e===r;if(e===r)return!0;for(const t of[e,r])for(const n in t)if(!(t===r&&n in e||t===e&&n in r&&E(e[n],r[n])))return!1;return!0}return e===r})),U=s(((e,r,t,n)=>e(n)?r(n):t(n))),_=u(((e,r,t)=>U(e,r,W,t))),F=(...r)=>(...t)=>{let n,s=!0;for(let c=T(r)-1;c>-1;c--)s?(s=!1,n=r[c](...t)):n=n===e?r[c]():r[c](n);return n},I=o(((e,r)=>e.bind(r))),L=o(((e,r)=>r[e])),q=o(((e,r)=>{if((e=>"string"===l(e))(r))return r.includes(e);for(const t of r)if(E(t,e))return!0;return!1})),z=u(((e,r,t)=>t.slice(e,h(r)?r:i))),D=e=>o(((r,t)=>e(t,r))),G=L(0),H=z(1,i),J=o(((e,r)=>e+r)),K=o(((e,r)=>r-e)),M=o(((e,r)=>e*r)),Q=o(((e,r)=>e/r)),R=e=>f(e)||(e=>e===a)(e),T=e=>e.length,V=e=>()=>e,W=e=>e,X=e=>e.trim(),Y=e=>e[T(e)-1],Z=e=>!e,ee=e=>(...r)=>{const t=e(...r);return g(t)&&t.$args_left?ee(t):Z(t)},re=e=>Object.keys(e),te=e=>Object.values(e),ne=e=>Object.entries(e),se=o(((e,r)=>e.test(r))),ce=o(((e,r)=>(e(r),r))),oe=o(((e,r)=>[...r,e])),ue=o(((e,r)=>r.split(e))),ae=V(!0),ie=V(!1),le=o(((e,r)=>r(...e))),fe=(...e)=>{},he=e=>{if("Object"===j(e)){let r=0;for(let t in e)r++;return r}return T(e)},be=o(((e,r)=>ye(J(e),r-e))),ge=e=>A(((e,r)=>q(r,e)?e:w(r,e)),[],e),pe=o(((e,r)=>e.filter(D(q)(r)))),ye=o(((e,r)=>[...Array(r)].map(((r,t)=>e(t))))),de=e=>{let r,t=!1;return(...n)=>t?r:(t=!0,r=e(...n))},je=e=>F((r=>Me(((t,n,s)=>w(e[r-s],t)),[],e)),J(-1),T)(e),me=o(((e,r)=>e>r)),we=o(((e,r)=>e<r)),Oe=o(((e,r)=>r>=e)),Ae=o(((e,r)=>r<=e)),Se=o(((e,r)=>r.sort(e))),ke=o(((e,r)=>r.find(e))),ve=o(((e,r)=>r.findIndex(e))),Ne=o(((e,r)=>ve(E(e),r))),xe=(e,r="log")=>ce((t=>console[r](e,t))),Ce=o(((e,r)=>{for(const[t,n]of e)if(t(r))return n(r)})),Pe=u(((e,r,t)=>({...t,[e]:r}))),$e=u(((e,r,t)=>F((n=>{return Pe(n,T(e)<2?r:$e(z(1,i,e),r,(s=t[n],f(s)||"object"!==l(s)?{}:t[n])),t);var s}),G)(e))),Be=o(((e,r)=>r.every(e))),Ee=o(((e,r)=>r.some(e))),Ue=o(((e,r)=>e.every((e=>e(r))))),_e=o(((e,r)=>e.some((e=>e(r))))),Fe=o(((e,r)=>r[e])),Ie=u(((e,r,t)=>E(t[e],r))),Le=u(((e,r,t)=>E(r[e],t[e]))),qe=u(((e,r,t)=>U(T,(()=>R(t)?e:F(U(R,V(e),(t=>qe(e,z(1,i,r),t))),D(Fe)(t),G)(r)),V(t),r))),ze=qe(a),De=u(((e,r,t)=>E(ze(e,t),r))),Ge=u(((e,r,t)=>E(ze(e,r),ze(e,t)))),He=/^(.*?)(8|16|32|64)(Clamped)?Array$/,Je=(e,r=!1)=>{const t=j(e);switch(t){case"Null":case"String":case"Number":case"Boolean":case"Symbol":return e;case"Array":return r?[...e]:Ye(F(Je,B(0)),e);case"Object":if(r)return{...e};const n={};for(let r in e)n[r]=Je(e[r]);return n;default:return He.test(t)?e.constructor.from(e):e}},Ke=e=>Je(e,!0),Me=u(((e,r,t)=>A(e,Je(r),t))),Qe=o(((e,r)=>sr(e,r))),Re=o(((e,r)=>{const t={};for(const n of e)n in r&&(t[n]=r[n]);return t})),Te=o(((e,r)=>sr(((r,t)=>!q(t,e)),r))),Ve=e=>Me(((e,r)=>Pe(...r,e)),{},e),We=o(((e,r)=>r.concat(e))),Xe=o(((e,r)=>r.join(e))),Ye=o(((e,r)=>r.map(e))),Ze=o(((e,r)=>r.forEach(e))),er=u(((e,r,t)=>r(t)&&e(t))),rr=e=>{switch(j(e)){case"String":case"Array":return 0==T(e);case"Object":for(const r in e)return!1;return!0;default:return null}},tr=e=>{switch(j(e)){case"String":return"";case"Object":return{};case"Array":return[];default:return a}},nr=u(((e,r,t)=>t.replace(e,r))),sr=o(((e,r)=>b(r)?r.filter(e):F(Ve,sr((([r,t])=>e(t,r))),ne)(r))),cr=e=>{let r,t=!1;return()=>t?r:(t=!0,r=e())},or=o(((e,r)=>Object.assign({},e,r))),ur=o(((e,r)=>k(Je(e),Je(r)))),ar=o(((e,r)=>v(Je(e),Je(r)))),ir=o(((e,r)=>N(Je(e),Je(r)))),lr=u(((e,r,t)=>Pe(e,r(t[e]),t))),fr=o(((e,r)=>x(e,Object.assign({},r)))),hr=o(((e,r)=>Ye(((e,t)=>[e,r[t]]),e))),br=o(((e,r)=>Me(((e,t,n)=>Pe(t,r[n],e)),{},e))),gr=u(((e,r,t)=>Ye(((r,n)=>e(r,t[n])),r))),pr=(()=>{const e=async(r,t,n)=>{n<t.length&&(await r(t[n]),await e(r,t,++n))};return o(((r,t)=>e(r,t,0)))})(),yr=e=>Promise.all(e),dr=o((async(e,r)=>(await e(r),r))),jr=o(((e,r)=>Promise.all(r.map(e)))),mr=(()=>{const e=async(r,t,n)=>~n?await e(r,await r[n](t),--n):t;return(...r)=>t=>e(r,t,r.length-1)})(),wr=W,Or=W,Ar=W,Sr=ee,kr=e=>{const r=[],t=[],n=e.length;let s,c,o,u=0,a=0,i=!1,l=G(e),f=!1;for(u=0;u<n;u++)switch(s=e[u],s){case"{":if(!l){i=!0,a=u;break}case"}":if(!l){i=!1,r.push(""),t.push(e.slice(a+1,u));break}default:o=e[u+1],f="\\"===s,i||f&&("{"===o||"}"===o)||(c=r.length-1,c<0&&(r.push(""),c++),r[c]+=s),l=f}return e=>{const n=[],s=r.length-1;for(const c in r)u=+c,n.push(r[u]),u!==s&&n.push(ze(t[u].split("."),e));return n.join("")}};export{ie as F,ae as T,e as __,J as add,Be as all,Ue as allPass,V as always,Ee as any,_e as anyPass,oe as append,Pe as assoc,$e as assocPath,I as bind,er as both,le as callWith,Je as clone,Ke as cloneShallow,ee as complement,F as compose,mr as composeAsync,We as concat,Ce as cond,s as curry,o as curry2,u as curry3,Q as divide,Ar as echo,tr as empty,E as equals,xe as explore,sr as filter,ke as find,ve as findIndex,D as flip,Ze as forEach,jr as forEachAsync,pr as forEachSerial,Ve as fromPairs,ye as genBy,kr as getTmpl,me as gt,Oe as gte,G as head,W as identity,U as ifElse,q as includes,Ne as indexOf,pe as intersection,rr as isEmpty,R as isNil,Xe as join,re as keys,Y as last,T as length,we as lt,Ae as lte,Ye as map,fr as mapKeys,cr as memoize,ur as mergeDeep,ir as mergeDeepAdd,ar as mergeDeepX,or as mergeShallow,wr as mirror,M as multiply,fe as noop,Z as not,Sr as notf,L as nth,Te as omit,de as once,lr as overProp,ze as path,De as pathEq,qe as pathOr,Ge as pathsEq,Re as pick,Qe as pickBy,Fe as prop,Ie as propEq,Le as propsEq,w as qappend,O as qassoc,C as qfilter,P as qindexOf,x as qmapKeys,k as qmergeDeep,N as qmergeDeepAdd,v as qmergeDeepX,A as qreduce,be as range,Me as reduce,Or as reflect,nr as replace,je as reverse,he as sizeof,z as slice,Se as sort,ue as split,K as subtract,H as tail,B as take,ce as tap,se as test,y as toLower,ne as toPairs,d as toUpper,X as trim,j as type,m as typeIs,$ as uncurry,ge as uniq,te as values,yr as waitAll,dr as waitTap,_ as when,hr as zip,br as zipObj,gr as zipWith};
|
package/dts-fix.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import prepend from 'prepend'
|
|
2
|
-
|
|
3
|
-
const s =
|
|
4
|
-
`import {F as FT} from 'ts-toolbelt'
|
|
5
|
-
export { __ }
|
|
6
|
-
`
|
|
7
2
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
const s = 'export { __ }\n'
|
|
4
|
+
|
|
5
|
+
prepend('./dist/bundle.d.ts', s, function(error) {
|
|
6
|
+
if (error)
|
|
7
|
+
console.error(error.message)
|
|
11
8
|
})
|
package/package.json
CHANGED
|
@@ -5,9 +5,8 @@
|
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/houd1ni/pepka/issues"
|
|
7
7
|
},
|
|
8
|
-
"bundleDependencies": [],
|
|
9
8
|
"deprecated": false,
|
|
10
|
-
"description": "An ultra lightweight or unsafe-speedy ramda alternative.",
|
|
9
|
+
"description": "An ultra lightweight, async or unsafe-speedy ramda alternative.",
|
|
11
10
|
"homepage": "https://houd1ni.github.io/pepka/",
|
|
12
11
|
"keywords": [
|
|
13
12
|
"ramda",
|
|
@@ -22,7 +21,7 @@
|
|
|
22
21
|
"type": "module",
|
|
23
22
|
"exports": {
|
|
24
23
|
".": {
|
|
25
|
-
"
|
|
24
|
+
"import": "./dist/bundle.mjs",
|
|
26
25
|
"require": "./dist/bundle.cjs"
|
|
27
26
|
}
|
|
28
27
|
},
|
|
@@ -44,16 +43,19 @@
|
|
|
44
43
|
"prod": "npm run gentypes && npm run prod:es && npm run prod:cjs",
|
|
45
44
|
"all": "npm run dev && npm run prod"
|
|
46
45
|
},
|
|
47
|
-
"version": "0.14.
|
|
46
|
+
"version": "0.14.1",
|
|
48
47
|
"ava": {
|
|
49
|
-
"files": [
|
|
48
|
+
"files": [
|
|
49
|
+
"./test/specs/*.ts"
|
|
50
|
+
],
|
|
50
51
|
"failFast": true,
|
|
51
52
|
"timeout": "2m",
|
|
52
|
-
"extensions": [
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
"extensions": [
|
|
54
|
+
"ts"
|
|
55
|
+
],
|
|
56
|
+
"require": [
|
|
57
|
+
"ts-node/register"
|
|
58
|
+
]
|
|
57
59
|
},
|
|
58
60
|
"devDependencies": {
|
|
59
61
|
"@rollup/plugin-commonjs": "^23.0.3",
|
package/src/curry.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { A, F as FT } from 'ts-toolbelt'
|
|
2
1
|
import { AnyFunc, AnyArgs } from "./types"
|
|
3
2
|
|
|
4
3
|
type Placeholder = symbol
|
|
@@ -45,14 +44,12 @@ const _curry = (fn: Function, args: AnyArgs, new_args: AnyArgs) => {
|
|
|
45
44
|
}
|
|
46
45
|
}
|
|
47
46
|
|
|
48
|
-
export const curry = (
|
|
49
|
-
|
|
50
|
-
(
|
|
51
|
-
|
|
52
|
-
: fn(...args)
|
|
53
|
-
) as FT.Curry<Func>
|
|
47
|
+
export const curry = (fn: AnyFunc) => (
|
|
48
|
+
(...args: AnyArgs) => fn.length>countArgs(args)
|
|
49
|
+
? _curry(fn, [], args)
|
|
50
|
+
: fn(...args)
|
|
54
51
|
)
|
|
55
|
-
const endlessph = <Func extends
|
|
52
|
+
const endlessph = <Func extends AnyFunc>(fn: Func) => {
|
|
56
53
|
type ReturnT = ReturnType<Func>
|
|
57
54
|
type p0 = Parameters<Func>[0]
|
|
58
55
|
function _endlessph(a: p0): ReturnT
|
|
@@ -93,5 +90,7 @@ export function curry3<Func extends Func3>(fn: Func) {
|
|
|
93
90
|
// type p2 = Parameters<Func>[2]
|
|
94
91
|
// type ReturnT = ReturnType<Func>
|
|
95
92
|
// TODO: optimize.
|
|
96
|
-
|
|
93
|
+
// Cannot use ts-toolbelt due to this error:
|
|
94
|
+
// Excessive stack depth comparing types 'GapsOf<?, L2>' and 'GapsOf<?, L2>'
|
|
95
|
+
return curry(fn)
|
|
97
96
|
}
|
package/src/quick.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { type } from "./common"
|
|
|
3
3
|
import { AnyObject, Reducer, AnyFunc } from "./types"
|
|
4
4
|
import { isFunc, isArray } from "./utils"
|
|
5
5
|
|
|
6
|
-
// TODO: qmap, qfilter
|
|
6
|
+
// TODO: qmap, qfilter, qoverProp, qover array ?
|
|
7
7
|
|
|
8
8
|
export const qappend = curry2((s: any, xs: any[]) => {xs.push(s); return xs})
|
|
9
9
|
export const qassoc = curry3(
|
package/src/safe.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { F as FT } from 'ts-toolbelt'
|
|
2
1
|
import { __, curry, curry2, curry3 } from './curry'
|
|
3
2
|
import { isNum, isUndef, undef, isNull, isArray, isFunc, isStr, isObj, inf } from './utils'
|
|
4
3
|
import { qmergeDeep, qreduce, qappend, qmapKeys, qmergeDeepX, qmergeDeepAdd } from './quick'
|
|
5
|
-
import { AnyFunc, Cond, AnyObject, Reducer
|
|
4
|
+
import { AnyFunc, Cond, AnyObject, Reducer } from './types'
|
|
6
5
|
import { type } from './common'
|
|
7
|
-
//
|
|
6
|
+
// over, lensProp
|
|
8
7
|
|
|
9
8
|
export const take = (argN: number) => (...args: any[]) => args[argN]
|
|
10
9
|
export const equals = curry2((a: any, b: any) => {
|
|
@@ -91,7 +90,7 @@ export const flip =
|
|
|
91
90
|
<T extends AnyFunc>(fn: T) => curry2(
|
|
92
91
|
(b: Parameters<T>[1], a: Parameters<T>[0]) => fn(a, b)
|
|
93
92
|
)
|
|
94
|
-
export const head = nth(0)
|
|
93
|
+
export const head = nth(0) as <T = any>(xs: T[] | string) => T
|
|
95
94
|
export const tail = slice(1, inf) // typeshit.
|
|
96
95
|
export const add = curry2((n: number, m: number) => n+m)
|
|
97
96
|
export const subtract = curry2((n: number, m: number) => m-n)
|
|
@@ -117,6 +116,8 @@ export const append = curry2((s: any, xs: any[]) => [...xs, s])
|
|
|
117
116
|
export const split = curry2((s: string|RegExp, xs: string) => xs.split(s))
|
|
118
117
|
export const T = always<true>(true) as (...args: any[]) => true
|
|
119
118
|
export const F = always<false>(false) as (...args: any[]) => false
|
|
119
|
+
export const callWith = curry2((args: any[], fn: AnyFunc) => fn(...args))
|
|
120
|
+
export const noop = (..._args: any[]) => {}
|
|
120
121
|
export const sizeof = (s: any[] | string | AnyObject) => {
|
|
121
122
|
if(type(s) === 'Object') {
|
|
122
123
|
let len = 0
|
|
@@ -152,7 +153,7 @@ export const once = <Func extends AnyFunc>(fn: Func) => {
|
|
|
152
153
|
}
|
|
153
154
|
}
|
|
154
155
|
export const reverse = (xs: any[]) => compose(
|
|
155
|
-
<T>(ln: number) => reduce
|
|
156
|
+
<T>(ln: number) => reduce(
|
|
156
157
|
(nxs: T[], _: any, i: number) => qappend(xs[ln-i], nxs),
|
|
157
158
|
[], xs
|
|
158
159
|
),
|
|
@@ -179,6 +180,11 @@ export const cond = curry2(
|
|
|
179
180
|
}
|
|
180
181
|
}
|
|
181
182
|
)
|
|
183
|
+
/** Assigns a prop to an object.
|
|
184
|
+
* @param prop string
|
|
185
|
+
* @param value any
|
|
186
|
+
* @param object AnyObject
|
|
187
|
+
*/
|
|
182
188
|
export const assoc = curry3(
|
|
183
189
|
(prop: string, v: any, obj: AnyObject) => ({
|
|
184
190
|
...obj,
|
|
@@ -258,9 +264,14 @@ export const clone = (s: any, shallow = false) => {
|
|
|
258
264
|
}
|
|
259
265
|
export const cloneShallow = (s: any) => clone(s, true)
|
|
260
266
|
|
|
267
|
+
/** types T1, T2
|
|
268
|
+
* @param reducer (accum: T1, current: T2, index: number) => newAccum: T1
|
|
269
|
+
* @param accum T1
|
|
270
|
+
* @param array T2[]
|
|
271
|
+
*/
|
|
261
272
|
export const reduce = curry3(
|
|
262
|
-
<T = any>(
|
|
263
|
-
qreduce(
|
|
273
|
+
<T = any>(reducer: Reducer<T>, accum: T, arr: any[]) =>
|
|
274
|
+
qreduce(reducer, clone(accum), arr)
|
|
264
275
|
)
|
|
265
276
|
export const pickBy = curry2(
|
|
266
277
|
(cond: Cond, o: AnyObject) => filter(cond, o)
|
|
@@ -282,14 +293,14 @@ export const omit = curry2(
|
|
|
282
293
|
o
|
|
283
294
|
)
|
|
284
295
|
)
|
|
285
|
-
export const fromPairs = (pairs: [string, any][]) => reduce
|
|
296
|
+
export const fromPairs = (pairs: [string, any][]) => reduce(
|
|
286
297
|
(o: AnyObject, pair: [string, any]) => assoc(...pair, o),
|
|
287
298
|
{}, pairs
|
|
288
299
|
)
|
|
289
300
|
type Concat = ((a: string, b: string) => string)
|
|
290
301
|
| ((a: any[], b: any[]) => any[])
|
|
291
302
|
export const concat = curry2(
|
|
292
|
-
((a, b) =>
|
|
303
|
+
((a, b) => b.concat(a)) as Concat
|
|
293
304
|
)
|
|
294
305
|
export const join = curry2(
|
|
295
306
|
(delimeter: string, arr: string[]) => arr.join(delimeter)
|
|
@@ -350,13 +361,13 @@ export const mergeShallow = curry2(
|
|
|
350
361
|
Object.assign({}, o1, o2)
|
|
351
362
|
)
|
|
352
363
|
export const mergeDeep = curry2(
|
|
353
|
-
(a: AnyObject, b: AnyObject) => qmergeDeep(clone(a), clone(b))
|
|
364
|
+
(a: AnyObject, b: AnyObject) => qmergeDeep(clone(a), clone(b)) as AnyObject
|
|
354
365
|
)
|
|
355
366
|
export const mergeDeepX = curry2(
|
|
356
|
-
(a: AnyObject, b: AnyObject) => qmergeDeepX(clone(a), clone(b))
|
|
367
|
+
(a: AnyObject, b: AnyObject) => qmergeDeepX(clone(a), clone(b)) as AnyObject
|
|
357
368
|
)
|
|
358
369
|
export const mergeDeepAdd = curry2(
|
|
359
|
-
(a: AnyObject, b: AnyObject) => qmergeDeepAdd(clone(a), clone(b))
|
|
370
|
+
(a: AnyObject, b: AnyObject) => qmergeDeepAdd(clone(a), clone(b)) as AnyObject
|
|
360
371
|
)
|
|
361
372
|
export const overProp = curry3(
|
|
362
373
|
(prop: string, pipe: AnyFunc, data: any) =>
|
|
@@ -369,6 +380,24 @@ export const mapKeys = curry2(
|
|
|
369
380
|
o: AnyObject
|
|
370
381
|
) => qmapKeys(keyMap, Object.assign({}, o))
|
|
371
382
|
)
|
|
383
|
+
export const zip = curry2(
|
|
384
|
+
<T1 = any, T2 = any>(a: T1[], b: T2[]) => map((s: T1, i: number) => [s, b[i]], a)
|
|
385
|
+
)
|
|
386
|
+
export const zipObj = curry2(
|
|
387
|
+
<T1 = any, T2 = any>(a: T1[], b: T2[]) =>
|
|
388
|
+
reduce((ac: AnyObject, s: T1, i: number) => assoc(s, b[i], ac), {}, a)
|
|
389
|
+
)
|
|
390
|
+
// TODO: Tuple curried functions to replace these `AnyFuncs`.
|
|
391
|
+
/** zips through a pipe. Types T1, T2, T3.
|
|
392
|
+
* @returns T3[]
|
|
393
|
+
* @param pipe (T1, T2) => T3
|
|
394
|
+
* @param a T1[]
|
|
395
|
+
* @param b T2[]
|
|
396
|
+
*/
|
|
397
|
+
export const zipWith = curry3(
|
|
398
|
+
<T1 = any, T2 = any>(pipe: AnyFunc, a: T1[], b: T2[]) =>
|
|
399
|
+
map((s: T1, i: number) => pipe(s, b[i]), a)
|
|
400
|
+
)
|
|
372
401
|
|
|
373
402
|
// ASYNCS
|
|
374
403
|
|
|
@@ -403,4 +432,5 @@ export const composeAsync = (() => {
|
|
|
403
432
|
// ALIASES
|
|
404
433
|
export const mirror = identity
|
|
405
434
|
export const reflect = identity
|
|
406
|
-
export const echo = identity
|
|
435
|
+
export const echo = identity
|
|
436
|
+
export const notf = complement
|
package/src/uncurry.ts
CHANGED