pepka 0.14.0-beta1 → 0.14.0-beta12
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 -0
- package/dist/bundle.d.ts +46 -155
- package/dist/{bundle.esm.js → bundle.mjs} +1 -1
- package/package.json +80 -76
- package/rollup.config.js +1 -2
- package/src/curry.ts +8 -9
- package/src/safe.ts +14 -16
- package/src/types.ts +3 -2
- package/src/uncurry.ts +1 -1
- package/dist/bundle.dev.js +0 -598
- package/dist/bundle.js +0 -1
package/dist/bundle.cjs
ADDED
|
@@ -0,0 +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))),N=c(((e,r,t)=>D(e,r,M,t))),B=(...r)=>(...t)=>{let s,o=!0;for(let p=H(r)-1;p>-1;p--)o?(o=!1,s=r[p](...t)):s=s===e?r[p]():r[p](s);return s},_=n(((e,r)=>e.bind(r))),C=n(((e,r)=>r[e])),I=n(((e,r)=>{if((e=>"string"===i(e))(r))return r.includes(e);for(const t of r)if(P(t,e))return!0;return!1})),T=c(((e,r,t)=>t.slice(e,u(r)?r:a))),U=e=>n(((r,t)=>e(t,r))),$=C(0),z=T(1,a),F=n(((e,r)=>e+r)),K=n(((e,r)=>r-e)),L=n(((e,r)=>e*r)),X=n(((e,r)=>e/r)),G=e=>l(e)||(e=>e===x)(e),H=e=>e.length,J=e=>()=>e,M=e=>e,Q=e=>!e,R=e=>(...r)=>{const t=e(...r);return h(t)&&t.$args_left?R(t):Q(t)},V=e=>Object.entries(e),W=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=J(!0),te=J(!1),se=n(((e,r)=>pe(F(e),r-e))),oe=n(((e,r)=>e.filter(U(I)(r)))),pe=n(((e,r)=>[...Array(r)].map(((r,t)=>e(t))))),ne=n(((e,r)=>e>r)),ce=n(((e,r)=>e<r)),xe=n(((e,r)=>r>=e)),ae=n(((e,r)=>r<=e)),ie=n(((e,r)=>r.sort(e))),le=n(((e,r)=>r.find(e))),ue=n(((e,r)=>r.findIndex(e))),fe=n(((e,r)=>ue(P(e),r))),he=n(((e,r)=>{for(const[t,s]of e)if(t(r))return s(r)})),de=c(((e,r,t)=>({...t,[e]:r}))),me=c(((e,r,t)=>B((s=>{return de(s,H(e)<2?r:me(T(1,a,e),r,(o=t[s],l(o)||"object"!==i(o)?{}:t[s])),t);var o}),$)(e))),ye=n(((e,r)=>r.every(e))),ge=n(((e,r)=>r.some(e))),be=n(((e,r)=>e.every((e=>e(r))))),we=n(((e,r)=>e.some((e=>e(r))))),je=n(((e,r)=>r[e])),Oe=c(((e,r,t)=>P(t[e],r))),qe=c(((e,r,t)=>P(r[e],t[e]))),Ae=c(((e,r,t)=>D(H,(()=>G(t)?e:B(D(G,J(e),(t=>Ae(e,T(1,a,r),t))),U(je)(t),$)(r)),J(t),r))),Ee=Ae(x),ke=c(((e,r,t)=>P(Ee(e,t),r))),Se=c(((e,r,t)=>P(Ee(e,r),Ee(e,t)))),ve=/^(.*?)(8|16|32|64)(Clamped)?Array$/,Pe=(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(B(Pe,v(0)),e);case"Object":if(r)return{...e};const s={};for(let r in e)s[r]=Pe(e[r]);return s;default:return ve.test(t)?e.constructor.from(e):e}},De=c(((e,r,t)=>w(e,Pe(r),t))),Ne=n(((e,r)=>Ke(e,r))),Be=n(((e,r)=>{const t={};for(const s of e)s in r&&(t[s]=r[s]);return t})),_e=n(((e,r)=>Ke(((r,t)=>!I(t,e)),r))),Ce=e=>De(((e,r)=>de(...r,e)),{},e),Ie=n(((e,r)=>e.concat(r))),Te=n(((e,r)=>r.join(e))),Ue=n(((e,r)=>r.map(e))),$e=n(((e,r)=>r.forEach(e))),ze=c(((e,r,t)=>r(t)&&e(t))),Fe=c(((e,r,t)=>t.replace(e,r))),Ke=n(((e,r)=>f(r)?r.filter(e):B(Ce,Ke((([r,t])=>e(t,r))),V)(r))),Le=n(((e,r)=>Object.assign({},e,r))),Xe=n(((e,r)=>O(Pe(e),Pe(r)))),Ge=n(((e,r)=>q(Pe(e),Pe(r)))),He=n(((e,r)=>A(Pe(e),Pe(r)))),Je=c(((e,r,t)=>de(e,r(t[e]),t))),Me=n(((e,r)=>E(e,Object.assign({},r)))),Qe=(()=>{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)))})(),Re=n((async(e,r)=>(await e(r),r))),Ve=n(((e,r)=>Promise.all(r.map(e)))),We=(()=>{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)})(),Ye=M,Ze=M,er=M;exports.F=te,exports.T=re,exports.__=e,exports.add=F,exports.all=ye,exports.allPass=be,exports.always=J,exports.any=ge,exports.anyPass=we,exports.append=Z,exports.assoc=de,exports.assocPath=me,exports.bind=_,exports.both=ze,exports.clone=Pe,exports.cloneShallow=e=>Pe(e,!0),exports.complement=R,exports.compose=B,exports.composeAsync=We,exports.concat=Ie,exports.cond=he,exports.curry=o,exports.curry2=n,exports.curry3=c,exports.divide=X,exports.echo=er,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=Ke,exports.find=le,exports.findIndex=ue,exports.flip=U,exports.forEach=$e,exports.forEachAsync=Ve,exports.forEachSerial=Qe,exports.fromPairs=Ce,exports.genBy=pe,exports.getTmpl=e=>{const r=[],t=[],s=e.length;let o,p,n,c=0,x=0,a=!1,i=$(e),l=!1;for(c=0;c<s;c++)switch(o=e[c],o){case"{":if(!i){a=!0,x=c;break}case"}":if(!i){a=!1,r.push(""),t.push(e.slice(x+1,c));break}default:n=e[c+1],l="\\"===o,a||l&&("{"===n||"}"===n)||(p=r.length-1,p<0&&(r.push(""),p++),r[p]+=o),i=l}return e=>{const s=[],o=r.length-1;for(const p in r)c=+p,s.push(r[c]),c!==o&&s.push(Ee(t[c].split("."),e));return s.join("")}},exports.gt=ne,exports.gte=xe,exports.head=$,exports.identity=M,exports.ifElse=D,exports.includes=I,exports.indexOf=fe,exports.intersection=oe,exports.isEmpty=e=>{switch(m(e)){case"String":case"Array":return 0==H(e);case"Object":for(const r in e)return!1;return!0;default:return null}},exports.isNil=G,exports.join=Te,exports.keys=e=>Object.keys(e),exports.last=e=>e[H(e)-1],exports.length=H,exports.lt=ce,exports.lte=ae,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=Le,exports.mirror=Ye,exports.multiply=L,exports.not=Q,exports.nth=C,exports.omit=_e,exports.once=e=>{let r,t=!1;return(...s)=>t?r:(t=!0,r=e(...s))},exports.overProp=Je,exports.path=Ee,exports.pathEq=ke,exports.pathOr=Ae,exports.pathsEq=Se,exports.pick=Be,exports.pickBy=Ne,exports.prop=je,exports.propEq=Oe,exports.propsEq=qe,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=se,exports.reduce=De,exports.reflect=Ze,exports.replace=Fe,exports.reverse=e=>B((r=>De(((t,s,o)=>g(e[r-o],t)),[],e)),F(-1),H)(e),exports.sizeof=e=>{if("Object"===m(e)){let r=0;for(let t in e)r++;return r}return H(e)},exports.slice=T,exports.sort=ie,exports.split=ee,exports.subtract=K,exports.tail=z,exports.take=v,exports.tap=Y,exports.test=W,exports.toLower=e=>e.toLowerCase(),exports.toPairs=V,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)=>I(r,e)?e:g(r,e)),[],e),exports.values=e=>Object.values(e),exports.waitAll=e=>Promise.all(e),exports.waitTap=Re,exports.when=N;
|
package/dist/bundle.d.ts
CHANGED
|
@@ -9,11 +9,10 @@ export interface AnyObject {
|
|
|
9
9
|
}
|
|
10
10
|
export type AnyArgs = any[];
|
|
11
11
|
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
12
|
export type AnyFunc<ReturnT = any, Args extends AnyArgs = AnyArgs> = (...args: Args) => ReturnT;
|
|
14
13
|
export type Placeholder = symbol;
|
|
15
14
|
declare const __: Placeholder;
|
|
16
|
-
export declare const curry:
|
|
15
|
+
export declare const curry: (fn: AnyFunc) => (...args: AnyArgs) => any;
|
|
17
16
|
export type Func2 = (a: any, b: any) => any;
|
|
18
17
|
export declare function curry2<Func extends Func2>(fn: Func): {
|
|
19
18
|
(a: Placeholder, b: Parameters<Func>[1]): (a: Parameters<Func>[0]) => ReturnType<Func>;
|
|
@@ -22,7 +21,7 @@ export declare function curry2<Func extends Func2>(fn: Func): {
|
|
|
22
21
|
(a: Parameters<Func>[0], b: Parameters<Func>[1]): ReturnType<Func>;
|
|
23
22
|
};
|
|
24
23
|
export type Func3 = (a: any, b: any, c: any) => any;
|
|
25
|
-
export declare function curry3<Func extends Func3>(fn: Func):
|
|
24
|
+
export declare function curry3<Func extends Func3>(fn: Func): (...args: AnyArgs) => any;
|
|
26
25
|
export declare const uncurry: <Args extends any[] = any[], ReturnT = any>(fn: Curried<Args, any>) => AnyFunc;
|
|
27
26
|
export declare const toLower: (s: string) => string;
|
|
28
27
|
export declare const toUpper: (s: string) => string;
|
|
@@ -40,8 +39,8 @@ export declare const equals: {
|
|
|
40
39
|
(a: any): (b: any) => boolean;
|
|
41
40
|
(a: any, b: any): boolean;
|
|
42
41
|
};
|
|
43
|
-
export declare const ifElse:
|
|
44
|
-
export declare const when:
|
|
42
|
+
export declare const ifElse: (...args: AnyArgs) => any;
|
|
43
|
+
export declare const when: (...args: AnyArgs) => any;
|
|
45
44
|
export type Composed<TIn extends any[], TOut> = (...xs: TIn) => TOut;
|
|
46
45
|
export declare const compose: <TIn extends any[] = any[], TOut = any>(...fns: AnyFunc[]) => Composed<TIn, TOut>;
|
|
47
46
|
export declare const bind: {
|
|
@@ -62,11 +61,15 @@ export declare const includes: {
|
|
|
62
61
|
(a: unknown): (b: unknown[]) => boolean;
|
|
63
62
|
(a: unknown, b: unknown[]): boolean;
|
|
64
63
|
};
|
|
65
|
-
export declare const slice:
|
|
66
|
-
export
|
|
67
|
-
|
|
64
|
+
export declare const slice: (...args: AnyArgs) => any;
|
|
65
|
+
export declare const flip: <T extends AnyFunc<any, AnyArgs>>(fn: T) => {
|
|
66
|
+
(a: symbol, b: Parameters<T>[0]): (a: Parameters<T>[1]) => any;
|
|
67
|
+
(a: Parameters<T>[1], b: symbol): (b: Parameters<T>[0]) => any;
|
|
68
|
+
(a: Parameters<T>[1]): (b: Parameters<T>[0]) => any;
|
|
69
|
+
(a: Parameters<T>[1], b: Parameters<T>[0]): any;
|
|
70
|
+
};
|
|
68
71
|
export declare const head: (b: string | unknown[]) => unknown;
|
|
69
|
-
export declare const tail:
|
|
72
|
+
export declare const tail: any;
|
|
70
73
|
export declare const add: {
|
|
71
74
|
(a: symbol, b: number): (a: number) => number;
|
|
72
75
|
(a: number, b: symbol): (b: number) => number;
|
|
@@ -220,9 +223,7 @@ export declare const cond: {
|
|
|
220
223
|
Function
|
|
221
224
|
][], b: any): any;
|
|
222
225
|
};
|
|
223
|
-
export declare const assoc:
|
|
224
|
-
[x: string]: any;
|
|
225
|
-
}>;
|
|
226
|
+
export declare const assoc: (...args: AnyArgs) => any;
|
|
226
227
|
export declare const assocPath: any;
|
|
227
228
|
export declare const all: {
|
|
228
229
|
(a: symbol, b: any[]): (a: Cond) => boolean;
|
|
@@ -254,18 +255,15 @@ export declare const prop: {
|
|
|
254
255
|
(a: string): (b: AnyObject) => any;
|
|
255
256
|
(a: string, b: AnyObject): any;
|
|
256
257
|
};
|
|
257
|
-
export declare const propEq:
|
|
258
|
-
export declare const propsEq:
|
|
259
|
-
export declare const pathOr:
|
|
260
|
-
export declare const path:
|
|
261
|
-
export declare const pathEq:
|
|
262
|
-
export declare const pathsEq:
|
|
258
|
+
export declare const propEq: (...args: AnyArgs) => any;
|
|
259
|
+
export declare const propsEq: (...args: AnyArgs) => any;
|
|
260
|
+
export declare const pathOr: (...args: AnyArgs) => any;
|
|
261
|
+
export declare const path: any;
|
|
262
|
+
export declare const pathEq: (...args: AnyArgs) => any;
|
|
263
|
+
export declare const pathsEq: (...args: AnyArgs) => any;
|
|
263
264
|
export declare const clone: (s: any, shallow?: boolean) => any;
|
|
264
265
|
export declare const cloneShallow: (s: any) => any;
|
|
265
|
-
export declare const reduce:
|
|
266
|
-
] | [
|
|
267
|
-
accum: any
|
|
268
|
-
]) => any>>;
|
|
266
|
+
export declare const reduce: (...args: AnyArgs) => any;
|
|
269
267
|
export declare const pickBy: {
|
|
270
268
|
(a: symbol, b: AnyObject): (a: Cond) => any;
|
|
271
269
|
(a: Cond, b: symbol): (b: AnyObject) => any;
|
|
@@ -287,10 +285,7 @@ export declare const omit: {
|
|
|
287
285
|
export declare const fromPairs: (pairs: [
|
|
288
286
|
string,
|
|
289
287
|
any
|
|
290
|
-
][]) =>
|
|
291
|
-
] | [
|
|
292
|
-
accum: any
|
|
293
|
-
]) => any>>;
|
|
288
|
+
][]) => any;
|
|
294
289
|
export declare const concat: {
|
|
295
290
|
(a: symbol, b: string | any[]): (a: string | any[]) => string | any[];
|
|
296
291
|
(a: string | any[], b: symbol): (b: string | any[]) => string | any[];
|
|
@@ -304,10 +299,10 @@ export declare const join: {
|
|
|
304
299
|
(a: string, b: string[]): string;
|
|
305
300
|
};
|
|
306
301
|
export declare const map: {
|
|
307
|
-
(a: symbol, b: any[]): (a: (s: any) => any) => any[];
|
|
308
|
-
(a: (s: any) => any, b: symbol): (b: any[]) => any[];
|
|
309
|
-
(a: (s: any) => any): (b: any[]) => any[];
|
|
310
|
-
(a: (s: any) => any, b: any[]): any[];
|
|
302
|
+
(a: symbol, b: any[]): (a: (s: any, i?: number, list?: any[]) => any) => any[];
|
|
303
|
+
(a: (s: any, i?: number, list?: any[]) => any, b: symbol): (b: any[]) => any[];
|
|
304
|
+
(a: (s: any, i?: number, list?: any[]) => any): (b: any[]) => any[];
|
|
305
|
+
(a: (s: any, i?: number, list?: any[]) => any, b: any[]): any[];
|
|
311
306
|
};
|
|
312
307
|
export declare const forEach: {
|
|
313
308
|
(a: symbol, b: any[]): (a: (s: any) => any) => void;
|
|
@@ -315,10 +310,10 @@ export declare const forEach: {
|
|
|
315
310
|
(a: (s: any) => any): (b: any[]) => void;
|
|
316
311
|
(a: (s: any) => any, b: any[]): void;
|
|
317
312
|
};
|
|
318
|
-
export declare const both:
|
|
313
|
+
export declare const both: (...args: AnyArgs) => any;
|
|
319
314
|
export declare const isEmpty: (s: any) => boolean | null;
|
|
320
315
|
export declare const empty: (s: any) => {} | undefined;
|
|
321
|
-
export declare const replace:
|
|
316
|
+
export declare const replace: (...args: AnyArgs) => any;
|
|
322
317
|
export declare const filter: any;
|
|
323
318
|
export declare const memoize: (fn: Function) => () => any;
|
|
324
319
|
export declare const mergeShallow: {
|
|
@@ -328,128 +323,24 @@ export declare const mergeShallow: {
|
|
|
328
323
|
(a: AnyObject, b: AnyObject): AnyObject;
|
|
329
324
|
};
|
|
330
325
|
export declare const mergeDeep: {
|
|
331
|
-
(a: symbol, b: AnyObject): (a: AnyObject) =>
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
] | [
|
|
336
|
-
o2: AnyObject
|
|
337
|
-
] | [
|
|
338
|
-
o1: AnyObject
|
|
339
|
-
]) => any>;
|
|
340
|
-
(a: AnyObject, b: symbol): (b: AnyObject) => FT.Curry<(...p: [
|
|
341
|
-
] | [
|
|
342
|
-
o1: AnyObject,
|
|
343
|
-
o2: AnyObject
|
|
344
|
-
] | [
|
|
345
|
-
o2: AnyObject
|
|
346
|
-
] | [
|
|
347
|
-
o1: AnyObject
|
|
348
|
-
]) => any>;
|
|
349
|
-
(a: AnyObject): (b: AnyObject) => FT.Curry<(...p: [
|
|
350
|
-
] | [
|
|
351
|
-
o1: AnyObject,
|
|
352
|
-
o2: AnyObject
|
|
353
|
-
] | [
|
|
354
|
-
o2: AnyObject
|
|
355
|
-
] | [
|
|
356
|
-
o1: AnyObject
|
|
357
|
-
]) => any>;
|
|
358
|
-
(a: AnyObject, b: AnyObject): FT.Curry<(...p: [
|
|
359
|
-
] | [
|
|
360
|
-
o1: AnyObject,
|
|
361
|
-
o2: AnyObject
|
|
362
|
-
] | [
|
|
363
|
-
o2: AnyObject
|
|
364
|
-
] | [
|
|
365
|
-
o1: AnyObject
|
|
366
|
-
]) => any>;
|
|
326
|
+
(a: symbol, b: AnyObject): (a: AnyObject) => AnyObject;
|
|
327
|
+
(a: AnyObject, b: symbol): (b: AnyObject) => AnyObject;
|
|
328
|
+
(a: AnyObject): (b: AnyObject) => AnyObject;
|
|
329
|
+
(a: AnyObject, b: AnyObject): AnyObject;
|
|
367
330
|
};
|
|
368
331
|
export declare const mergeDeepX: {
|
|
369
|
-
(a: symbol, b: AnyObject): (a: AnyObject) =>
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
] | [
|
|
374
|
-
o2: AnyObject
|
|
375
|
-
] | [
|
|
376
|
-
o1: AnyObject
|
|
377
|
-
]) => any>;
|
|
378
|
-
(a: AnyObject, b: symbol): (b: AnyObject) => FT.Curry<(...p: [
|
|
379
|
-
] | [
|
|
380
|
-
o1: AnyObject,
|
|
381
|
-
o2: AnyObject
|
|
382
|
-
] | [
|
|
383
|
-
o2: AnyObject
|
|
384
|
-
] | [
|
|
385
|
-
o1: AnyObject
|
|
386
|
-
]) => any>;
|
|
387
|
-
(a: AnyObject): (b: AnyObject) => FT.Curry<(...p: [
|
|
388
|
-
] | [
|
|
389
|
-
o1: AnyObject,
|
|
390
|
-
o2: AnyObject
|
|
391
|
-
] | [
|
|
392
|
-
o2: AnyObject
|
|
393
|
-
] | [
|
|
394
|
-
o1: AnyObject
|
|
395
|
-
]) => any>;
|
|
396
|
-
(a: AnyObject, b: AnyObject): FT.Curry<(...p: [
|
|
397
|
-
] | [
|
|
398
|
-
o1: AnyObject,
|
|
399
|
-
o2: AnyObject
|
|
400
|
-
] | [
|
|
401
|
-
o2: AnyObject
|
|
402
|
-
] | [
|
|
403
|
-
o1: AnyObject
|
|
404
|
-
]) => any>;
|
|
332
|
+
(a: symbol, b: AnyObject): (a: AnyObject) => AnyObject;
|
|
333
|
+
(a: AnyObject, b: symbol): (b: AnyObject) => AnyObject;
|
|
334
|
+
(a: AnyObject): (b: AnyObject) => AnyObject;
|
|
335
|
+
(a: AnyObject, b: AnyObject): AnyObject;
|
|
405
336
|
};
|
|
406
337
|
export declare const mergeDeepAdd: {
|
|
407
|
-
(a: symbol, b: AnyObject): (a: AnyObject) =>
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
] | [
|
|
414
|
-
o1: AnyObject
|
|
415
|
-
]) => any>;
|
|
416
|
-
(a: AnyObject, b: symbol): (b: AnyObject) => FT.Curry<(...p: [
|
|
417
|
-
] | [
|
|
418
|
-
o1: AnyObject,
|
|
419
|
-
o2: AnyObject
|
|
420
|
-
] | [
|
|
421
|
-
o2: AnyObject
|
|
422
|
-
] | [
|
|
423
|
-
o1: AnyObject
|
|
424
|
-
]) => any>;
|
|
425
|
-
(a: AnyObject): (b: AnyObject) => FT.Curry<(...p: [
|
|
426
|
-
] | [
|
|
427
|
-
o1: AnyObject,
|
|
428
|
-
o2: AnyObject
|
|
429
|
-
] | [
|
|
430
|
-
o2: AnyObject
|
|
431
|
-
] | [
|
|
432
|
-
o1: AnyObject
|
|
433
|
-
]) => any>;
|
|
434
|
-
(a: AnyObject, b: AnyObject): FT.Curry<(...p: [
|
|
435
|
-
] | [
|
|
436
|
-
o1: AnyObject,
|
|
437
|
-
o2: AnyObject
|
|
438
|
-
] | [
|
|
439
|
-
o2: AnyObject
|
|
440
|
-
] | [
|
|
441
|
-
o1: AnyObject
|
|
442
|
-
]) => any>;
|
|
443
|
-
};
|
|
444
|
-
export declare const overProp: FT.Curry<(prop: string, pipe: AnyFunc, data: any) => FT.Curry<(...p: [
|
|
445
|
-
] | [
|
|
446
|
-
v: any,
|
|
447
|
-
obj: AnyObject
|
|
448
|
-
] | [
|
|
449
|
-
obj: AnyObject
|
|
450
|
-
] | [
|
|
451
|
-
v: any
|
|
452
|
-
]) => any>>;
|
|
338
|
+
(a: symbol, b: AnyObject): (a: AnyObject) => AnyObject;
|
|
339
|
+
(a: AnyObject, b: symbol): (b: AnyObject) => AnyObject;
|
|
340
|
+
(a: AnyObject): (b: AnyObject) => AnyObject;
|
|
341
|
+
(a: AnyObject, b: AnyObject): AnyObject;
|
|
342
|
+
};
|
|
343
|
+
export declare const overProp: (...args: AnyArgs) => any;
|
|
453
344
|
/** mapKeys({ a: 'b' }, { a: 44 }) -> { b: 44 } */
|
|
454
345
|
export declare const mapKeys: {
|
|
455
346
|
(a: symbol, b: AnyObject): (a: {
|
|
@@ -498,11 +389,11 @@ export declare const qappend: {
|
|
|
498
389
|
(a: any): (b: any[]) => any[];
|
|
499
390
|
(a: any, b: any[]): any[];
|
|
500
391
|
};
|
|
501
|
-
export declare const qassoc:
|
|
502
|
-
export declare const qreduce:
|
|
503
|
-
export declare const qmergeDeep:
|
|
504
|
-
export declare const qmergeDeepX:
|
|
505
|
-
export declare const qmergeDeepAdd:
|
|
392
|
+
export declare const qassoc: (...args: AnyArgs) => any;
|
|
393
|
+
export declare const qreduce: (...args: AnyArgs) => any;
|
|
394
|
+
export declare const qmergeDeep: any;
|
|
395
|
+
export declare const qmergeDeepX: any;
|
|
396
|
+
export declare const qmergeDeepAdd: any;
|
|
506
397
|
/** qmapKeys({ a: 'b' }, { a: 44 }) -> { b: 44 } */
|
|
507
398
|
export declare const qmapKeys: {
|
|
508
399
|
(a: symbol, b: AnyObject): (a: {
|
|
@@ -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)},fe=o(((e,r)=>ge(J(e),r-e))),he=e=>A(((e,r)=>q(r,e)?e:w(r,e)),[],e),be=o(((e,r)=>e.filter(D(q)(r)))),ge=o(((e,r)=>[...Array(r)].map(((r,t)=>e(t))))),pe=e=>{let r,t=!1;return(...n)=>t?r:(t=!0,r=e(...n))},ye=e=>F((r=>Je(((t,n,s)=>w(e[r-s],t)),[],e)),J(-1),T)(e),de=o(((e,r)=>e>r)),je=o(((e,r)=>e<r)),me=o(((e,r)=>r>=e)),we=o(((e,r)=>r<=e)),Oe=o(((e,r)=>r.sort(e))),Ae=o(((e,r)=>r.find(e))),Se=o(((e,r)=>r.findIndex(e))),ke=o(((e,r)=>Se(E(e),r))),ve=(e,r="log")=>ce((t=>console[r](e,t))),Ne=o(((e,r)=>{for(const[t,n]of e)if(t(r))return n(r)})),xe=u(((e,r,t)=>({...t,[e]:r}))),Ce=u(((e,r,t)=>F((n=>{return xe(n,T(e)<2?r:Ce(z(1,i,e),r,(s=t[n],f(s)||"object"!==l(s)?{}:t[n])),t);var s}),G)(e))),Pe=o(((e,r)=>r.every(e))),$e=o(((e,r)=>r.some(e))),Be=o(((e,r)=>e.every((e=>e(r))))),Ee=o(((e,r)=>e.some((e=>e(r))))),Ue=o(((e,r)=>r[e])),_e=u(((e,r,t)=>E(t[e],r))),Fe=u(((e,r,t)=>E(r[e],t[e]))),Ie=u(((e,r,t)=>U(T,(()=>R(t)?e:F(U(R,V(e),(t=>Ie(e,z(1,i,r),t))),D(Ue)(t),G)(r)),V(t),r))),Le=Ie(a),qe=u(((e,r,t)=>E(Le(e,t),r))),ze=u(((e,r,t)=>E(Le(e,r),Le(e,t)))),De=/^(.*?)(8|16|32|64)(Clamped)?Array$/,Ge=(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]:We(Ge,e);case"Object":if(r)return{...e};const n={};for(let r in e)n[r]=Ge(e[r]);return n;default:return De.test(t)?e.constructor.from(e):e}},He=e=>Ge(e,!0),Je=u(((e,r,t)=>A(e,Ge(r),t))),Ke=o(((e,r)=>tr(e,r))),Me=o(((e,r)=>{const t={};for(const n of e)n in r&&(t[n]=r[n]);return t})),Qe=o(((e,r)=>tr(((r,t)=>!q(t,e)),r))),Re=e=>Je(((e,r)=>xe(...r,e)),{},e),Te=o(((e,r)=>e.concat(r))),Ve=o(((e,r)=>r.join(e))),We=o(((e,r)=>r.map(e))),Xe=o(((e,r)=>r.forEach(e))),Ye=u(((e,r,t)=>r(t)&&e(t))),Ze=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}},er=e=>{switch(j(e)){case"String":return"";case"Object":return{};case"Array":return[];default:return a}},rr=u(((e,r,t)=>t.replace(e,r))),tr=o(((e,r)=>b(r)?r.filter(e):F(Re,tr((([r,t])=>e(t,r))),ne)(r))),nr=e=>{let r,t=!1;return()=>t?r:(t=!0,r=e())},sr=o(((e,r)=>Object.assign({},e,r))),cr=o(((e,r)=>k(Ge(e),Ge(r)))),or=o(((e,r)=>v(Ge(e),Ge(r)))),ur=o(((e,r)=>N(Ge(e),Ge(r)))),ar=u(((e,r,t)=>xe(e,r(t[e]),t))),ir=o(((e,r)=>x(e,Object.assign({},r)))),lr=(()=>{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)))})(),fr=e=>Promise.all(e),hr=o((async(e,r)=>(await e(r),r))),br=o(((e,r)=>Promise.all(r.map(e)))),gr=(()=>{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)})(),pr=W,yr=W,dr=W,jr=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(Le(t[u].split("."),e));return n.join("")}};export{ie as F,ae as T,e as __,J as add,Pe as all,Be as allPass,V as always,$e as any,Ee as anyPass,oe as append,xe as assoc,Ce as assocPath,I as bind,Ye as both,Ge as clone,He as cloneShallow,ee as complement,F as compose,gr as composeAsync,Te as concat,Ne as cond,s as curry,o as curry2,u as curry3,Q as divide,dr as echo,er as empty,E as equals,ve as explore,tr as filter,Ae as find,Se as findIndex,D as flip,Xe as forEach,br as forEachAsync,lr as forEachSerial,Re as fromPairs,ge as genBy,jr as getTmpl,de as gt,me as gte,G as head,W as identity,U as ifElse,q as includes,ke as indexOf,be as intersection,Ze as isEmpty,R as isNil,Ve as join,re as keys,Y as last,T as length,je as lt,we as lte,We as map,ir as mapKeys,nr as memoize,cr as mergeDeep,ur as mergeDeepAdd,or as mergeDeepX,sr as mergeShallow,pr as mirror,M as multiply,Z as not,L as nth,Qe as omit,pe as once,ar as overProp,Le as path,qe as pathEq,Ie as pathOr,ze as pathsEq,Me as pick,Ke as pickBy,Ue as prop,_e as propEq,Fe 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,fe as range,Je as reduce,yr as reflect,rr as replace,ye as reverse,le as sizeof,z as slice,Oe 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,he as uniq,te as values,fr as waitAll,hr as waitTap,_ as when};
|
|
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)},fe=o(((e,r)=>ge(J(e),r-e))),he=e=>A(((e,r)=>q(r,e)?e:w(r,e)),[],e),be=o(((e,r)=>e.filter(D(q)(r)))),ge=o(((e,r)=>[...Array(r)].map(((r,t)=>e(t))))),pe=e=>{let r,t=!1;return(...n)=>t?r:(t=!0,r=e(...n))},ye=e=>F((r=>Je(((t,n,s)=>w(e[r-s],t)),[],e)),J(-1),T)(e),de=o(((e,r)=>e>r)),je=o(((e,r)=>e<r)),me=o(((e,r)=>r>=e)),we=o(((e,r)=>r<=e)),Oe=o(((e,r)=>r.sort(e))),Ae=o(((e,r)=>r.find(e))),Se=o(((e,r)=>r.findIndex(e))),ke=o(((e,r)=>Se(E(e),r))),ve=(e,r="log")=>ce((t=>console[r](e,t))),Ne=o(((e,r)=>{for(const[t,n]of e)if(t(r))return n(r)})),xe=u(((e,r,t)=>({...t,[e]:r}))),Ce=u(((e,r,t)=>F((n=>{return xe(n,T(e)<2?r:Ce(z(1,i,e),r,(s=t[n],f(s)||"object"!==l(s)?{}:t[n])),t);var s}),G)(e))),Pe=o(((e,r)=>r.every(e))),$e=o(((e,r)=>r.some(e))),Be=o(((e,r)=>e.every((e=>e(r))))),Ee=o(((e,r)=>e.some((e=>e(r))))),Ue=o(((e,r)=>r[e])),_e=u(((e,r,t)=>E(t[e],r))),Fe=u(((e,r,t)=>E(r[e],t[e]))),Ie=u(((e,r,t)=>U(T,(()=>R(t)?e:F(U(R,V(e),(t=>Ie(e,z(1,i,r),t))),D(Ue)(t),G)(r)),V(t),r))),Le=Ie(a),qe=u(((e,r,t)=>E(Le(e,t),r))),ze=u(((e,r,t)=>E(Le(e,r),Le(e,t)))),De=/^(.*?)(8|16|32|64)(Clamped)?Array$/,Ge=(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]:We(F(Ge,B(0)),e);case"Object":if(r)return{...e};const n={};for(let r in e)n[r]=Ge(e[r]);return n;default:return De.test(t)?e.constructor.from(e):e}},He=e=>Ge(e,!0),Je=u(((e,r,t)=>A(e,Ge(r),t))),Ke=o(((e,r)=>tr(e,r))),Me=o(((e,r)=>{const t={};for(const n of e)n in r&&(t[n]=r[n]);return t})),Qe=o(((e,r)=>tr(((r,t)=>!q(t,e)),r))),Re=e=>Je(((e,r)=>xe(...r,e)),{},e),Te=o(((e,r)=>e.concat(r))),Ve=o(((e,r)=>r.join(e))),We=o(((e,r)=>r.map(e))),Xe=o(((e,r)=>r.forEach(e))),Ye=u(((e,r,t)=>r(t)&&e(t))),Ze=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}},er=e=>{switch(j(e)){case"String":return"";case"Object":return{};case"Array":return[];default:return a}},rr=u(((e,r,t)=>t.replace(e,r))),tr=o(((e,r)=>b(r)?r.filter(e):F(Re,tr((([r,t])=>e(t,r))),ne)(r))),nr=e=>{let r,t=!1;return()=>t?r:(t=!0,r=e())},sr=o(((e,r)=>Object.assign({},e,r))),cr=o(((e,r)=>k(Ge(e),Ge(r)))),or=o(((e,r)=>v(Ge(e),Ge(r)))),ur=o(((e,r)=>N(Ge(e),Ge(r)))),ar=u(((e,r,t)=>xe(e,r(t[e]),t))),ir=o(((e,r)=>x(e,Object.assign({},r)))),lr=(()=>{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)))})(),fr=e=>Promise.all(e),hr=o((async(e,r)=>(await e(r),r))),br=o(((e,r)=>Promise.all(r.map(e)))),gr=(()=>{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)})(),pr=W,yr=W,dr=W,jr=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(Le(t[u].split("."),e));return n.join("")}};export{ie as F,ae as T,e as __,J as add,Pe as all,Be as allPass,V as always,$e as any,Ee as anyPass,oe as append,xe as assoc,Ce as assocPath,I as bind,Ye as both,Ge as clone,He as cloneShallow,ee as complement,F as compose,gr as composeAsync,Te as concat,Ne as cond,s as curry,o as curry2,u as curry3,Q as divide,dr as echo,er as empty,E as equals,ve as explore,tr as filter,Ae as find,Se as findIndex,D as flip,Xe as forEach,br as forEachAsync,lr as forEachSerial,Re as fromPairs,ge as genBy,jr as getTmpl,de as gt,me as gte,G as head,W as identity,U as ifElse,q as includes,ke as indexOf,be as intersection,Ze as isEmpty,R as isNil,Ve as join,re as keys,Y as last,T as length,je as lt,we as lte,We as map,ir as mapKeys,nr as memoize,cr as mergeDeep,ur as mergeDeepAdd,or as mergeDeepX,sr as mergeShallow,pr as mirror,M as multiply,Z as not,L as nth,Qe as omit,pe as once,ar as overProp,Le as path,qe as pathEq,Ie as pathOr,ze as pathsEq,Me as pick,Ke as pickBy,Ue as prop,_e as propEq,Fe 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,fe as range,Je as reduce,yr as reflect,rr as replace,ye as reverse,le as sizeof,z as slice,Oe 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,he as uniq,te as values,fr as waitAll,hr as waitTap,_ as when};
|
package/package.json
CHANGED
|
@@ -1,76 +1,80 @@
|
|
|
1
|
-
{
|
|
2
|
-
"author": {
|
|
3
|
-
"name": "Michael houd1ni Akiliev"
|
|
4
|
-
},
|
|
5
|
-
"bugs": {
|
|
6
|
-
"url": "https://github.com/houd1ni/pepka/issues"
|
|
7
|
-
},
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
"
|
|
29
|
-
|
|
30
|
-
"
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"
|
|
35
|
-
"test
|
|
36
|
-
"test:
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"prod:
|
|
42
|
-
"prod": "
|
|
43
|
-
"
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
"
|
|
47
|
-
|
|
48
|
-
"
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
"
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
"@
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
1
|
+
{
|
|
2
|
+
"author": {
|
|
3
|
+
"name": "Michael houd1ni Akiliev"
|
|
4
|
+
},
|
|
5
|
+
"bugs": {
|
|
6
|
+
"url": "https://github.com/houd1ni/pepka/issues"
|
|
7
|
+
},
|
|
8
|
+
"deprecated": false,
|
|
9
|
+
"description": "An ultra lightweight or unsafe-speedy ramda alternative.",
|
|
10
|
+
"homepage": "https://houd1ni.github.io/pepka/",
|
|
11
|
+
"keywords": [
|
|
12
|
+
"ramda",
|
|
13
|
+
"functional",
|
|
14
|
+
"fp",
|
|
15
|
+
"pure",
|
|
16
|
+
"strongly-typed",
|
|
17
|
+
"typescript",
|
|
18
|
+
"d.ts"
|
|
19
|
+
],
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"type": "module",
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"module": "./dist/bundle.mjs",
|
|
25
|
+
"require": "./dist/bundle.cjs"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"name": "pepka",
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "git+https://github.com/houd1ni/pepka.git"
|
|
32
|
+
},
|
|
33
|
+
"scripts": {
|
|
34
|
+
"lint": "tslint src/*.ts",
|
|
35
|
+
"test": "npm run gentypes && npm run prod:cjs && ava",
|
|
36
|
+
"test:report": "nyc npm test && nyc report --reporter=text-lcov > coverage.lcov && codecov",
|
|
37
|
+
"test:lazy": "ava",
|
|
38
|
+
"dts-fix": "node dts-fix.js",
|
|
39
|
+
"gentypes": "dts-bundle-generator --no-check -o dist/bundle.d.ts src/index.ts && npm run dts-fix",
|
|
40
|
+
"dev": "cross-env NODE_ENV=development BUILD=es rollup -c",
|
|
41
|
+
"prod:cjs": "cross-env NODE_ENV=production BUILD=cjs rollup -c",
|
|
42
|
+
"prod:es": "cross-env NODE_ENV=production BUILD=es rollup -c",
|
|
43
|
+
"prod": "npm run gentypes && npm run prod:es && npm run prod:cjs",
|
|
44
|
+
"all": "npm run dev && npm run prod"
|
|
45
|
+
},
|
|
46
|
+
"version": "0.14.0-beta12",
|
|
47
|
+
"ava": {
|
|
48
|
+
"files": [
|
|
49
|
+
"./test/specs/*.ts"
|
|
50
|
+
],
|
|
51
|
+
"failFast": true,
|
|
52
|
+
"timeout": "2m",
|
|
53
|
+
"extensions": [
|
|
54
|
+
"ts"
|
|
55
|
+
],
|
|
56
|
+
"require": [
|
|
57
|
+
"ts-node/register"
|
|
58
|
+
]
|
|
59
|
+
},
|
|
60
|
+
"devDependencies": {
|
|
61
|
+
"@rollup/plugin-commonjs": "^23.0.3",
|
|
62
|
+
"@rollup/plugin-node-resolve": "^15.0.1",
|
|
63
|
+
"@rollup/plugin-replace": "^5.0.1",
|
|
64
|
+
"@rollup/plugin-terser": "^0.1.0",
|
|
65
|
+
"@types/node": "^18.11.11",
|
|
66
|
+
"ava": "^5.1.0",
|
|
67
|
+
"codecov": "^3.8.2",
|
|
68
|
+
"cross-env": "^7.0.3",
|
|
69
|
+
"dts-bundle-generator": "^7.1.0",
|
|
70
|
+
"nyc": "^15.1.0",
|
|
71
|
+
"prepend": "^1.0.2",
|
|
72
|
+
"rollup": "^3.6.0",
|
|
73
|
+
"rollup-plugin-typescript2": "^0.34.1",
|
|
74
|
+
"ts-node": "^10.9.1",
|
|
75
|
+
"tslint": "^6.1.0",
|
|
76
|
+
"typescript": "^4.9.4"
|
|
77
|
+
},
|
|
78
|
+
"types": "./dist/bundle.d.ts",
|
|
79
|
+
"sideEffects": false
|
|
80
|
+
}
|
package/rollup.config.js
CHANGED
|
@@ -10,9 +10,8 @@ export default {
|
|
|
10
10
|
output: {
|
|
11
11
|
file: process.env.NODE_ENV=='development'
|
|
12
12
|
? 'dist/bundle.dev.js'
|
|
13
|
-
: process.env.BUILD == 'cjs' ? 'dist/bundle.
|
|
13
|
+
: process.env.BUILD == 'cjs' ? 'dist/bundle.cjs' : 'dist/bundle.mjs',
|
|
14
14
|
format: process.env.BUILD == 'cjs' ? 'cjs' : 'es',
|
|
15
|
-
// exports: 'named',
|
|
16
15
|
name: 'pepka'
|
|
17
16
|
},
|
|
18
17
|
treeshake: { moduleSideEffects: false },
|
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/safe.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
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, Curried } from './types'
|
|
4
|
+
import { AnyFunc, Cond, AnyObject, Reducer, Curried, TupleFn } from './types'
|
|
6
5
|
import { type } from './common'
|
|
7
6
|
// SomeType, totype, over, lensProp
|
|
8
7
|
|
|
@@ -87,11 +86,10 @@ export const slice = curry3(
|
|
|
87
86
|
(from: number, to: number, o: any[] | string) =>
|
|
88
87
|
o.slice(from, (isNum(to)?to:inf) as number)
|
|
89
88
|
)
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
)
|
|
94
|
-
curry2((b: ARG2, a: ARG1) => fn(a as any, b as any))
|
|
89
|
+
export const flip =
|
|
90
|
+
<T extends AnyFunc>(fn: T) => curry2(
|
|
91
|
+
(b: Parameters<T>[1], a: Parameters<T>[0]) => fn(a, b)
|
|
92
|
+
)
|
|
95
93
|
export const head = nth(0)
|
|
96
94
|
export const tail = slice(1, inf) // typeshit.
|
|
97
95
|
export const add = curry2((n: number, m: number) => n+m)
|
|
@@ -153,7 +151,7 @@ export const once = <Func extends AnyFunc>(fn: Func) => {
|
|
|
153
151
|
}
|
|
154
152
|
}
|
|
155
153
|
export const reverse = (xs: any[]) => compose(
|
|
156
|
-
<T>(ln: number) => reduce
|
|
154
|
+
<T>(ln: number) => reduce(
|
|
157
155
|
(nxs: T[], _: any, i: number) => qappend(xs[ln-i], nxs),
|
|
158
156
|
[], xs
|
|
159
157
|
),
|
|
@@ -214,7 +212,7 @@ export const propsEq = curry3(
|
|
|
214
212
|
(key: string, o1: any, o2: AnyObject) => equals(o1[key], o2[key])
|
|
215
213
|
)
|
|
216
214
|
export const pathOr = curry3(
|
|
217
|
-
(_default: any, path: string[], o: any) =>
|
|
215
|
+
(_default: any, path: (string | number)[], o: any) =>
|
|
218
216
|
ifElse(length,
|
|
219
217
|
() => isNil(o)
|
|
220
218
|
? _default
|
|
@@ -242,7 +240,7 @@ export const clone = (s: any, shallow = false) => {
|
|
|
242
240
|
const t = type(s)
|
|
243
241
|
switch(t) {
|
|
244
242
|
case 'Null': return s
|
|
245
|
-
case 'Array': return shallow ? [...s] : map(clone, s)
|
|
243
|
+
case 'Array': return shallow ? [...s] : map(compose(clone, take(0)), s)
|
|
246
244
|
case 'Object':
|
|
247
245
|
if(shallow) return {...s}
|
|
248
246
|
const out = {}
|
|
@@ -260,7 +258,7 @@ export const clone = (s: any, shallow = false) => {
|
|
|
260
258
|
export const cloneShallow = (s: any) => clone(s, true)
|
|
261
259
|
|
|
262
260
|
export const reduce = curry3(
|
|
263
|
-
(fn: Reducer
|
|
261
|
+
<T = any>(fn: Reducer<T>, accum: T, arr: any[]) =>
|
|
264
262
|
qreduce(fn, clone(accum), arr)
|
|
265
263
|
)
|
|
266
264
|
export const pickBy = curry2(
|
|
@@ -283,7 +281,7 @@ export const omit = curry2(
|
|
|
283
281
|
o
|
|
284
282
|
)
|
|
285
283
|
)
|
|
286
|
-
export const fromPairs = (pairs: [string, any][]) => reduce
|
|
284
|
+
export const fromPairs = (pairs: [string, any][]) => reduce(
|
|
287
285
|
(o: AnyObject, pair: [string, any]) => assoc(...pair, o),
|
|
288
286
|
{}, pairs
|
|
289
287
|
)
|
|
@@ -296,7 +294,7 @@ export const join = curry2(
|
|
|
296
294
|
(delimeter: string, arr: string[]) => arr.join(delimeter)
|
|
297
295
|
)
|
|
298
296
|
export const map = curry2(
|
|
299
|
-
(pipe: (s: any) => any, arr: any[]) => arr.map(pipe)
|
|
297
|
+
(pipe: (s: any, i?: number, list?: any[]) => any, arr: any[]) => arr.map(pipe)
|
|
300
298
|
)
|
|
301
299
|
export const forEach = curry2(
|
|
302
300
|
(pipe: (s: any) => any, arr: any[]) => arr.forEach(pipe)
|
|
@@ -351,13 +349,13 @@ export const mergeShallow = curry2(
|
|
|
351
349
|
Object.assign({}, o1, o2)
|
|
352
350
|
)
|
|
353
351
|
export const mergeDeep = curry2(
|
|
354
|
-
(a: AnyObject, b: AnyObject) => qmergeDeep(clone(a), clone(b))
|
|
352
|
+
(a: AnyObject, b: AnyObject) => qmergeDeep(clone(a), clone(b)) as AnyObject
|
|
355
353
|
)
|
|
356
354
|
export const mergeDeepX = curry2(
|
|
357
|
-
(a: AnyObject, b: AnyObject) => qmergeDeepX(clone(a), clone(b))
|
|
355
|
+
(a: AnyObject, b: AnyObject) => qmergeDeepX(clone(a), clone(b)) as AnyObject
|
|
358
356
|
)
|
|
359
357
|
export const mergeDeepAdd = curry2(
|
|
360
|
-
(a: AnyObject, b: AnyObject) => qmergeDeepAdd(clone(a), clone(b))
|
|
358
|
+
(a: AnyObject, b: AnyObject) => qmergeDeepAdd(clone(a), clone(b)) as AnyObject
|
|
361
359
|
)
|
|
362
360
|
export const overProp = curry3(
|
|
363
361
|
(prop: string, pipe: AnyFunc, data: any) =>
|
package/src/types.ts
CHANGED
|
@@ -7,8 +7,9 @@ export type Curried<
|
|
|
7
7
|
Args extends AnyArgs = AnyArgs,
|
|
8
8
|
ReturnT = any
|
|
9
9
|
> = (arg: Args[number]) => Curried<Args> | ReturnT
|
|
10
|
-
export type Reducer
|
|
10
|
+
export type Reducer<T=any> = (accum: T, cur: any, index: number) => T
|
|
11
11
|
export type AnyFunc<
|
|
12
12
|
ReturnT = any,
|
|
13
13
|
Args extends AnyArgs = AnyArgs
|
|
14
|
-
> = (...args: Args) => ReturnT
|
|
14
|
+
> = (...args: Args) => ReturnT
|
|
15
|
+
export type TupleFn<ARG1=any, ARG2=any, Out=any> = (a: ARG1, b: ARG2) => Out
|
package/src/uncurry.ts
CHANGED
package/dist/bundle.dev.js
DELETED
|
@@ -1,598 +0,0 @@
|
|
|
1
|
-
const __ = Symbol('Placeholder');
|
|
2
|
-
const countArgs = (s) => {
|
|
3
|
-
let i = 0;
|
|
4
|
-
for (const v of s)
|
|
5
|
-
v !== __ && i++;
|
|
6
|
-
return i;
|
|
7
|
-
};
|
|
8
|
-
// TODO: try to make it mutable.
|
|
9
|
-
// { 0: __, 1: 10 }, [ 11 ]
|
|
10
|
-
const addArgs = (args, _args) => {
|
|
11
|
-
const len = args.length;
|
|
12
|
-
const new_args = args.slice();
|
|
13
|
-
const _args_len = _args.length;
|
|
14
|
-
let _args_left = _args_len;
|
|
15
|
-
let i = 0;
|
|
16
|
-
for (; _args_left && i < len; i++) {
|
|
17
|
-
if (new_args[i] === __) {
|
|
18
|
-
new_args[i] = _args[_args_len - _args_left];
|
|
19
|
-
_args_left--;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
for (i = len; _args_left; i++, _args_left--) {
|
|
23
|
-
new_args[i] = _args[_args_len - _args_left];
|
|
24
|
-
}
|
|
25
|
-
return new_args;
|
|
26
|
-
};
|
|
27
|
-
const _curry = (fn, args, new_args) => {
|
|
28
|
-
const args2add = fn.length - args.length - countArgs(new_args);
|
|
29
|
-
if (args2add < 1) {
|
|
30
|
-
return fn(...addArgs(args, new_args));
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
const curried = (...__args) => _curry(fn, addArgs(args, new_args), __args);
|
|
34
|
-
curried.$args_left = args2add;
|
|
35
|
-
return curried;
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
const curry = ((fn) => ((...args) => fn.length > countArgs(args)
|
|
39
|
-
? _curry(fn, [], args)
|
|
40
|
-
: fn(...args)));
|
|
41
|
-
const endlessph = (fn) => {
|
|
42
|
-
function _endlessph(a) {
|
|
43
|
-
return a === __ ? fn : fn(a);
|
|
44
|
-
}
|
|
45
|
-
return _endlessph;
|
|
46
|
-
};
|
|
47
|
-
function curry2(fn) {
|
|
48
|
-
function curried2(a, b) {
|
|
49
|
-
const withPlaceholder1 = a === __;
|
|
50
|
-
const aln = arguments.length;
|
|
51
|
-
if (aln === 1 && withPlaceholder1)
|
|
52
|
-
throw new Error('Senseless placeholder usage.');
|
|
53
|
-
return arguments.length > 1
|
|
54
|
-
? withPlaceholder1
|
|
55
|
-
? endlessph((a) => fn(a, b))
|
|
56
|
-
: fn(a, b)
|
|
57
|
-
: (b) => fn(a, b);
|
|
58
|
-
}
|
|
59
|
-
return curried2;
|
|
60
|
-
}
|
|
61
|
-
function curry3(fn) {
|
|
62
|
-
// type p0 = Parameters<Func>[0]
|
|
63
|
-
// type p1 = Parameters<Func>[1]
|
|
64
|
-
// type p2 = Parameters<Func>[2]
|
|
65
|
-
// type ReturnT = ReturnType<Func>
|
|
66
|
-
// TODO: optimize.
|
|
67
|
-
return curry(fn);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
const undef = undefined;
|
|
71
|
-
const nul = null;
|
|
72
|
-
const inf = Infinity;
|
|
73
|
-
const to = (s) => typeof s;
|
|
74
|
-
const isNull = (s) => s === nul;
|
|
75
|
-
const isUndef = (s) => s === undef;
|
|
76
|
-
const isNum = (s) => to(s) == 'number';
|
|
77
|
-
const isArray = (s) => Array.isArray(s);
|
|
78
|
-
const isFunc = (s) => to(s) === 'function';
|
|
79
|
-
const isStr = (s) => to(s) === 'string';
|
|
80
|
-
const isObj = (s) => !isNull(s) && to(s) === 'object';
|
|
81
|
-
|
|
82
|
-
// It's faster that toUpperCase() !
|
|
83
|
-
const caseMap = {
|
|
84
|
-
u: 'U', b: 'B', n: 'N', s: 'S', f: 'F'
|
|
85
|
-
};
|
|
86
|
-
const toLower = (s) => s.toLowerCase();
|
|
87
|
-
const toUpper = (s) => s.toUpperCase();
|
|
88
|
-
const type = (s) => {
|
|
89
|
-
const t = to(s);
|
|
90
|
-
return t === 'object'
|
|
91
|
-
? isNull(s) ? 'Null' : s.constructor.name
|
|
92
|
-
: caseMap[t[0]] + t.slice(1);
|
|
93
|
-
};
|
|
94
|
-
const typeIs = curry2((t, s) => type(s) === t);
|
|
95
|
-
|
|
96
|
-
// TODO: qmap, qfilter.
|
|
97
|
-
const qappend = curry2((s, xs) => { xs.push(s); return xs; });
|
|
98
|
-
const qassoc = curry3((prop, v, obj) => {
|
|
99
|
-
obj[prop] = v;
|
|
100
|
-
return obj;
|
|
101
|
-
});
|
|
102
|
-
const qreduce = curry3((fn, accum, arr) => arr.reduce(fn, accum));
|
|
103
|
-
// strategy is for arrays: 1->clean, 2->merge, 3->push.
|
|
104
|
-
const mergeDeep$1 = curry3((strategy, o1, o2) => {
|
|
105
|
-
for (let k in o2) {
|
|
106
|
-
switch (type(o2[k])) {
|
|
107
|
-
case 'Array':
|
|
108
|
-
if (strategy > 1 && type(o1[k]) === 'Array') {
|
|
109
|
-
switch (strategy) {
|
|
110
|
-
case 2:
|
|
111
|
-
const o1k = o1[k], o2k = o2[k];
|
|
112
|
-
for (const i in o2k) {
|
|
113
|
-
if (o1k[i]) {
|
|
114
|
-
mergeDeep$1(strategy, o1k[i], o2k[i]);
|
|
115
|
-
}
|
|
116
|
-
else {
|
|
117
|
-
o1k[i] = o2k[i];
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
break;
|
|
121
|
-
case 3: o1[k].push(...o2[k]);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
else {
|
|
125
|
-
o1[k] = o2[k];
|
|
126
|
-
}
|
|
127
|
-
break;
|
|
128
|
-
case 'Object':
|
|
129
|
-
if (type(o1[k]) === 'Object') {
|
|
130
|
-
mergeDeep$1(strategy, o1[k], o2[k]);
|
|
131
|
-
break;
|
|
132
|
-
}
|
|
133
|
-
default:
|
|
134
|
-
o1[k] = o2[k];
|
|
135
|
-
break;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
return o1;
|
|
139
|
-
});
|
|
140
|
-
const qmergeDeep = mergeDeep$1(1);
|
|
141
|
-
const qmergeDeepX = mergeDeep$1(2);
|
|
142
|
-
const qmergeDeepAdd = mergeDeep$1(3);
|
|
143
|
-
/** qmapKeys({ a: 'b' }, { a: 44 }) -> { b: 44 } */
|
|
144
|
-
const qmapKeys = curry2((keyMap, o) => {
|
|
145
|
-
let k, mapped, newKey, newValue;
|
|
146
|
-
for (k in keyMap) {
|
|
147
|
-
mapped = keyMap[k];
|
|
148
|
-
[newKey, newValue] = isFunc(mapped)
|
|
149
|
-
? mapped(o)
|
|
150
|
-
: [mapped, o[k]];
|
|
151
|
-
o[newKey] = newValue;
|
|
152
|
-
if (k !== newKey) {
|
|
153
|
-
delete o[k];
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
return o;
|
|
157
|
-
});
|
|
158
|
-
const qfilter = curry2((cond, data) => {
|
|
159
|
-
const isArr = isArray(data);
|
|
160
|
-
for (let k in data) {
|
|
161
|
-
if (!cond(data[k], k)) {
|
|
162
|
-
if (isArr) {
|
|
163
|
-
data.splice(k, 1);
|
|
164
|
-
}
|
|
165
|
-
else {
|
|
166
|
-
// TODO: handle Maps and Sets ?
|
|
167
|
-
delete data[k];
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
return data;
|
|
172
|
-
});
|
|
173
|
-
/** @deprecated */
|
|
174
|
-
const qindexOf = curry2((x, xs) => xs.indexOf(x));
|
|
175
|
-
|
|
176
|
-
// TODO: possibly introduce a second argument limiting unfolding.
|
|
177
|
-
const uncurry = (fn) => (...args) => qreduce(((fn, arg) => fn ? fn(arg) : fn), fn, args);
|
|
178
|
-
|
|
179
|
-
// SomeType, totype, over, lensProp
|
|
180
|
-
// take (if not exsit in ramda):
|
|
181
|
-
/* res = code.replace(/css\`((.|\s)*?)\`/g, (_, g1) => {
|
|
182
|
-
return compressRules(g1)
|
|
183
|
-
}) ->
|
|
184
|
-
res = code.replace(/css\`((.|\s)*?)\`/g, compose(
|
|
185
|
-
compressRules,
|
|
186
|
-
take(2) // second arg
|
|
187
|
-
))
|
|
188
|
-
*/
|
|
189
|
-
const take = (argN) => (...args) => args[argN];
|
|
190
|
-
const equals = curry2((a, b) => {
|
|
191
|
-
const typea = type(a);
|
|
192
|
-
if (typea === type(b) && (typea === 'Object' || typea == 'Array')) {
|
|
193
|
-
if (isNull(a) || isNull(b)) {
|
|
194
|
-
return a === b;
|
|
195
|
-
}
|
|
196
|
-
if (a === b) {
|
|
197
|
-
return true;
|
|
198
|
-
}
|
|
199
|
-
for (const v of [a, b]) {
|
|
200
|
-
for (const k in v) {
|
|
201
|
-
if (!((v === b) && (k in a)) &&
|
|
202
|
-
!((v === a) && (k in b) && equals(a[k], b[k]))) {
|
|
203
|
-
return false;
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
return true;
|
|
208
|
-
}
|
|
209
|
-
return a === b;
|
|
210
|
-
});
|
|
211
|
-
const ifElse = curry((cond, pipeYes, pipeNo, s) => cond(s) ? pipeYes(s) : pipeNo(s));
|
|
212
|
-
const when = curry3((cond, pipe, s) => ifElse(cond, pipe, identity, s));
|
|
213
|
-
const compose = ((...fns) => (...args) => {
|
|
214
|
-
let first = true;
|
|
215
|
-
let s;
|
|
216
|
-
for (let i = length(fns) - 1; i > -1; i--) {
|
|
217
|
-
if (first) {
|
|
218
|
-
first = false;
|
|
219
|
-
s = fns[i](...args);
|
|
220
|
-
}
|
|
221
|
-
else
|
|
222
|
-
s = s === __ ? fns[i]() : fns[i](s);
|
|
223
|
-
}
|
|
224
|
-
return s;
|
|
225
|
-
});
|
|
226
|
-
const bind = curry2((fn, context) => fn.bind(context));
|
|
227
|
-
const _nth = (i, data) => data[i];
|
|
228
|
-
const nth = curry2(_nth);
|
|
229
|
-
const includes = curry2((s, ss) => {
|
|
230
|
-
if (isStr(ss)) {
|
|
231
|
-
return ss.includes(s);
|
|
232
|
-
}
|
|
233
|
-
else {
|
|
234
|
-
for (const a of ss) {
|
|
235
|
-
if (equals(a, s)) {
|
|
236
|
-
return true;
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
return false;
|
|
240
|
-
}
|
|
241
|
-
});
|
|
242
|
-
const slice = curry3((from, to, o) => o.slice(from, (isNum(to) ? to : inf)));
|
|
243
|
-
const head = nth(0);
|
|
244
|
-
const tail = slice(1, inf); // typeshit.
|
|
245
|
-
const add = curry2((n, m) => n + m);
|
|
246
|
-
const subtract = curry2((n, m) => m - n);
|
|
247
|
-
const multiply = curry2((n, m) => n * m);
|
|
248
|
-
const divide = curry2((n, m) => n / m);
|
|
249
|
-
const flip = (fn) => curry((b, a) => fn(a, b));
|
|
250
|
-
const isNil = (s) => isNull(s) || isUndef(s);
|
|
251
|
-
const length = (s) => s.length;
|
|
252
|
-
const always = (s) => () => s;
|
|
253
|
-
const identity = (s) => s;
|
|
254
|
-
const trim = (s) => s.trim();
|
|
255
|
-
const last = (s) => s[length(s) - 1];
|
|
256
|
-
const not = (o) => !o;
|
|
257
|
-
const complement = (fn) => (...args) => {
|
|
258
|
-
const out = fn(...args);
|
|
259
|
-
return (isFunc(out) && out.$args_left) ? complement(out) : not(out);
|
|
260
|
-
};
|
|
261
|
-
const keys = (o) => Object.keys(o);
|
|
262
|
-
const values = (o) => Object.values(o);
|
|
263
|
-
const toPairs = (o) => Object.entries(o);
|
|
264
|
-
const test = curry2((re, s) => re.test(s));
|
|
265
|
-
const tap = curry2((fn, s) => { fn(s); return s; });
|
|
266
|
-
const append = curry2((s, xs) => [...xs, s]);
|
|
267
|
-
const split = curry2((s, xs) => xs.split(s));
|
|
268
|
-
const T = always(true);
|
|
269
|
-
const F = always(false);
|
|
270
|
-
const sizeof = (s) => {
|
|
271
|
-
if (type(s) === 'Object') {
|
|
272
|
-
let len = 0;
|
|
273
|
-
for (let _k in s)
|
|
274
|
-
len++;
|
|
275
|
-
return len;
|
|
276
|
-
}
|
|
277
|
-
else
|
|
278
|
-
return length(s);
|
|
279
|
-
};
|
|
280
|
-
const range = curry2((from, to) => genBy(add(from), to - from));
|
|
281
|
-
const uniq = (xs) => qreduce((accum, x) => includes(x, accum) ? accum : qappend(x, accum), [], xs);
|
|
282
|
-
const intersection = curry2((xs1, xs2) => xs1.filter(flip(includes)(xs2)));
|
|
283
|
-
const genBy = curry2((generator, length) => [...Array(length)].map((_, i) => generator(i)));
|
|
284
|
-
const once = (fn) => {
|
|
285
|
-
let done = false, cache;
|
|
286
|
-
return (...args) => {
|
|
287
|
-
if (done) {
|
|
288
|
-
return cache;
|
|
289
|
-
}
|
|
290
|
-
else {
|
|
291
|
-
done = true;
|
|
292
|
-
return cache = fn(...args);
|
|
293
|
-
}
|
|
294
|
-
};
|
|
295
|
-
};
|
|
296
|
-
const reverse = (xs) => compose((ln) => reduce((nxs, _, i) => qappend(xs[ln - i], nxs), [], xs), add(-1), length)(xs);
|
|
297
|
-
const gt = curry2((a, b) => a > b);
|
|
298
|
-
const lt = curry2((a, b) => a < b);
|
|
299
|
-
const gte = curry2((a, b) => b >= a);
|
|
300
|
-
const lte = curry2((a, b) => b <= a);
|
|
301
|
-
const sort = curry2((sortFn, xs) => xs.sort(sortFn));
|
|
302
|
-
const find = curry2((fn, s) => s.find(fn));
|
|
303
|
-
const findIndex = curry2((fn, s) => s.findIndex(fn));
|
|
304
|
-
const indexOf = curry2((x, xs) => findIndex(equals(x), xs));
|
|
305
|
-
const explore = (caption, level = 'log') => tap((v) => console[level](caption, v));
|
|
306
|
-
const cond = curry2((pairs, s) => {
|
|
307
|
-
for (const [cond, fn] of pairs) {
|
|
308
|
-
if (cond(s)) {
|
|
309
|
-
return fn(s);
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
});
|
|
313
|
-
const assoc = curry3((prop, v, obj) => ({
|
|
314
|
-
...obj,
|
|
315
|
-
[prop]: v
|
|
316
|
-
}));
|
|
317
|
-
const assocPath = curry3((_path, v, o) => compose((first) => assoc(first, length(_path) < 2
|
|
318
|
-
? v
|
|
319
|
-
: assocPath(slice(1, inf, _path), v, isObj(o[first]) ? o[first] : {}), o), head)(_path));
|
|
320
|
-
const all = curry2((pred, xs) => xs.every(pred));
|
|
321
|
-
const any = curry2((pred, xs) => xs.some(pred));
|
|
322
|
-
const allPass = curry2((preds, x) => preds.every((pred) => pred(x)));
|
|
323
|
-
const anyPass = curry2((preds, x) => preds.some((pred) => pred(x)));
|
|
324
|
-
const prop = curry2((key, o) => o[key]);
|
|
325
|
-
const propEq = curry3((key, value, o) => equals(o[key], value));
|
|
326
|
-
const propsEq = curry3((key, o1, o2) => equals(o1[key], o2[key]));
|
|
327
|
-
const pathOr = curry3((_default, path, o) => ifElse(length, () => isNil(o)
|
|
328
|
-
? _default
|
|
329
|
-
: compose(ifElse(isNil, always(_default), (o) => pathOr(_default, slice(1, inf, path), o)), flip(prop)(o), head)(path), always(o), path));
|
|
330
|
-
const path = pathOr(undef);
|
|
331
|
-
const pathEq = curry3((_path, value, o) => equals(path(_path, o), value));
|
|
332
|
-
const pathsEq = curry3((_path, o1, o2) => equals(path(_path, o1), path(_path, o2)));
|
|
333
|
-
const typed_arr_re = /^(.*?)(8|16|32|64)(Clamped)?Array$/;
|
|
334
|
-
const clone = (s, shallow = false) => {
|
|
335
|
-
const t = type(s);
|
|
336
|
-
switch (t) {
|
|
337
|
-
case 'Null': return s;
|
|
338
|
-
case 'Array': return shallow ? [...s] : map(clone, s);
|
|
339
|
-
case 'Object':
|
|
340
|
-
if (shallow)
|
|
341
|
-
return { ...s };
|
|
342
|
-
const out = {};
|
|
343
|
-
for (let k in s) {
|
|
344
|
-
out[k] = clone(s[k]);
|
|
345
|
-
}
|
|
346
|
-
return out;
|
|
347
|
-
case 'String':
|
|
348
|
-
case 'Number':
|
|
349
|
-
case 'Boolean':
|
|
350
|
-
case 'Symbol':
|
|
351
|
-
return s;
|
|
352
|
-
default:
|
|
353
|
-
return typed_arr_re.test(t) ? s.constructor.from(s) : s;
|
|
354
|
-
}
|
|
355
|
-
};
|
|
356
|
-
const cloneShallow = (s) => clone(s, true);
|
|
357
|
-
const reduce = curry3((fn, accum, arr) => qreduce(fn, clone(accum), arr));
|
|
358
|
-
const pickBy = curry2((cond, o) => filter(cond, o));
|
|
359
|
-
const pick = curry2((props, o) => {
|
|
360
|
-
const out = {};
|
|
361
|
-
for (const p of props) {
|
|
362
|
-
if (p in o) {
|
|
363
|
-
out[p] = o[p];
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
return out;
|
|
367
|
-
});
|
|
368
|
-
const omit = curry2((props, o) => filter((_, k) => !includes(k, props), o));
|
|
369
|
-
const fromPairs = (pairs) => reduce((o, pair) => assoc(...pair, o), {}, pairs);
|
|
370
|
-
const concat = curry2(((a, b) => a.concat(b)));
|
|
371
|
-
const join = curry2((delimeter, arr) => arr.join(delimeter));
|
|
372
|
-
const map = curry2((pipe, arr) => arr.map(pipe));
|
|
373
|
-
const forEach = curry2((pipe, arr) => arr.forEach(pipe));
|
|
374
|
-
const both = curry3((cond1, cond2, s) => cond2(s) && cond1(s));
|
|
375
|
-
const isEmpty = (s) => {
|
|
376
|
-
switch (type(s)) {
|
|
377
|
-
case 'String':
|
|
378
|
-
case 'Array': return length(s) == 0;
|
|
379
|
-
case 'Object':
|
|
380
|
-
for (const _k in s)
|
|
381
|
-
return false;
|
|
382
|
-
return true;
|
|
383
|
-
default: return null;
|
|
384
|
-
}
|
|
385
|
-
};
|
|
386
|
-
const empty = (s) => {
|
|
387
|
-
switch (type(s)) {
|
|
388
|
-
case 'String': return '';
|
|
389
|
-
case 'Object': return {};
|
|
390
|
-
case 'Array': return [];
|
|
391
|
-
default: return undef;
|
|
392
|
-
}
|
|
393
|
-
};
|
|
394
|
-
const replace = curry3((a, b, where
|
|
395
|
-
// @ts-ignore-next Some bug with overload.
|
|
396
|
-
) => where.replace(a, b));
|
|
397
|
-
const filter = curry2((cond, data) => isArray(data)
|
|
398
|
-
? data.filter(cond)
|
|
399
|
-
: compose(fromPairs, filter(([k, v]) => cond(v, k)), toPairs)(data));
|
|
400
|
-
const memoize = (fn) => {
|
|
401
|
-
let cache;
|
|
402
|
-
let cached = false;
|
|
403
|
-
return () => cached ? cache : (cached = true, cache = fn());
|
|
404
|
-
};
|
|
405
|
-
const mergeShallow = curry2((o1, o2) => Object.assign({}, o1, o2));
|
|
406
|
-
const mergeDeep = curry2((a, b) => qmergeDeep(clone(a), clone(b)));
|
|
407
|
-
const mergeDeepX = curry2((a, b) => qmergeDeepX(clone(a), clone(b)));
|
|
408
|
-
const mergeDeepAdd = curry2((a, b) => qmergeDeepAdd(clone(a), clone(b)));
|
|
409
|
-
const overProp = curry3((prop, pipe, data) => assoc(prop, pipe(data[prop]), data));
|
|
410
|
-
/** mapKeys({ a: 'b' }, { a: 44 }) -> { b: 44 } */
|
|
411
|
-
const mapKeys = curry2((keyMap, o) => qmapKeys(keyMap, Object.assign({}, o)));
|
|
412
|
-
// ASYNCS
|
|
413
|
-
/** One promise waits for another. */
|
|
414
|
-
const forEachSerial = (() => {
|
|
415
|
-
const pipe = async (fn, items, i) => {
|
|
416
|
-
if (i < items.length) {
|
|
417
|
-
await fn(items[i]);
|
|
418
|
-
await pipe(fn, items, ++i);
|
|
419
|
-
}
|
|
420
|
-
};
|
|
421
|
-
return curry2((fn, items) => pipe(fn, items, 0));
|
|
422
|
-
})();
|
|
423
|
-
/** Promise.all wrapper for functional pipelining. */
|
|
424
|
-
const waitAll = (promises) => Promise.all(promises);
|
|
425
|
-
const waitTap = curry2(async (fn, s) => { await fn(s); return s; });
|
|
426
|
-
/** Waits for all promises mapped by the fn. */
|
|
427
|
-
const forEachAsync = curry2((fn, items) => Promise.all(items.map(fn)));
|
|
428
|
-
/** The same as compose, but waits for promises in chains and returns a Promise. */
|
|
429
|
-
const composeAsync = (() => {
|
|
430
|
-
const pipe = async (fns, data, i) => ~i ? await pipe(fns, await fns[i](data), --i) : data;
|
|
431
|
-
return (...fns) => (data) => pipe(fns, data, fns.length - 1);
|
|
432
|
-
})(); // as FT.Compose<'async'>
|
|
433
|
-
// ALIASES
|
|
434
|
-
const mirror = identity;
|
|
435
|
-
const reflect = identity;
|
|
436
|
-
const echo = identity;
|
|
437
|
-
|
|
438
|
-
const getTmpl = (tmpl) => {
|
|
439
|
-
const parts = [];
|
|
440
|
-
const keymap = [];
|
|
441
|
-
const len = tmpl.length;
|
|
442
|
-
let i = 0, s, ln, start = 0, open = false;
|
|
443
|
-
for (i = 0; i < len; i++) {
|
|
444
|
-
s = tmpl[i];
|
|
445
|
-
switch (s) {
|
|
446
|
-
case '{':
|
|
447
|
-
open = true;
|
|
448
|
-
start = i;
|
|
449
|
-
break;
|
|
450
|
-
case '}':
|
|
451
|
-
open = false;
|
|
452
|
-
parts.push('');
|
|
453
|
-
keymap.push(tmpl.slice(start + 1, i));
|
|
454
|
-
break;
|
|
455
|
-
default:
|
|
456
|
-
if (!open) {
|
|
457
|
-
ln = parts.length - 1;
|
|
458
|
-
if (ln < 0) {
|
|
459
|
-
parts.push('');
|
|
460
|
-
ln++;
|
|
461
|
-
}
|
|
462
|
-
parts[ln] += s;
|
|
463
|
-
}
|
|
464
|
-
break;
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
return (data) => {
|
|
468
|
-
const out = [];
|
|
469
|
-
const ln = parts.length - 1;
|
|
470
|
-
for (const j in parts) {
|
|
471
|
-
i = +j;
|
|
472
|
-
out.push(parts[i]);
|
|
473
|
-
if (i !== ln)
|
|
474
|
-
out.push(path(keymap[i].split('.'), data));
|
|
475
|
-
}
|
|
476
|
-
return out.join('');
|
|
477
|
-
};
|
|
478
|
-
};
|
|
479
|
-
|
|
480
|
-
var pepka = /*#__PURE__*/Object.freeze({
|
|
481
|
-
__proto__: null,
|
|
482
|
-
__: __,
|
|
483
|
-
curry: curry,
|
|
484
|
-
curry2: curry2,
|
|
485
|
-
curry3: curry3,
|
|
486
|
-
uncurry: uncurry,
|
|
487
|
-
toLower: toLower,
|
|
488
|
-
toUpper: toUpper,
|
|
489
|
-
type: type,
|
|
490
|
-
typeIs: typeIs,
|
|
491
|
-
take: take,
|
|
492
|
-
equals: equals,
|
|
493
|
-
ifElse: ifElse,
|
|
494
|
-
when: when,
|
|
495
|
-
compose: compose,
|
|
496
|
-
bind: bind,
|
|
497
|
-
nth: nth,
|
|
498
|
-
includes: includes,
|
|
499
|
-
slice: slice,
|
|
500
|
-
head: head,
|
|
501
|
-
tail: tail,
|
|
502
|
-
add: add,
|
|
503
|
-
subtract: subtract,
|
|
504
|
-
multiply: multiply,
|
|
505
|
-
divide: divide,
|
|
506
|
-
flip: flip,
|
|
507
|
-
isNil: isNil,
|
|
508
|
-
length: length,
|
|
509
|
-
always: always,
|
|
510
|
-
identity: identity,
|
|
511
|
-
trim: trim,
|
|
512
|
-
last: last,
|
|
513
|
-
not: not,
|
|
514
|
-
complement: complement,
|
|
515
|
-
keys: keys,
|
|
516
|
-
values: values,
|
|
517
|
-
toPairs: toPairs,
|
|
518
|
-
test: test,
|
|
519
|
-
tap: tap,
|
|
520
|
-
append: append,
|
|
521
|
-
split: split,
|
|
522
|
-
T: T,
|
|
523
|
-
F: F,
|
|
524
|
-
sizeof: sizeof,
|
|
525
|
-
range: range,
|
|
526
|
-
uniq: uniq,
|
|
527
|
-
intersection: intersection,
|
|
528
|
-
genBy: genBy,
|
|
529
|
-
once: once,
|
|
530
|
-
reverse: reverse,
|
|
531
|
-
gt: gt,
|
|
532
|
-
lt: lt,
|
|
533
|
-
gte: gte,
|
|
534
|
-
lte: lte,
|
|
535
|
-
sort: sort,
|
|
536
|
-
find: find,
|
|
537
|
-
findIndex: findIndex,
|
|
538
|
-
indexOf: indexOf,
|
|
539
|
-
explore: explore,
|
|
540
|
-
cond: cond,
|
|
541
|
-
assoc: assoc,
|
|
542
|
-
assocPath: assocPath,
|
|
543
|
-
all: all,
|
|
544
|
-
any: any,
|
|
545
|
-
allPass: allPass,
|
|
546
|
-
anyPass: anyPass,
|
|
547
|
-
prop: prop,
|
|
548
|
-
propEq: propEq,
|
|
549
|
-
propsEq: propsEq,
|
|
550
|
-
pathOr: pathOr,
|
|
551
|
-
path: path,
|
|
552
|
-
pathEq: pathEq,
|
|
553
|
-
pathsEq: pathsEq,
|
|
554
|
-
clone: clone,
|
|
555
|
-
cloneShallow: cloneShallow,
|
|
556
|
-
reduce: reduce,
|
|
557
|
-
pickBy: pickBy,
|
|
558
|
-
pick: pick,
|
|
559
|
-
omit: omit,
|
|
560
|
-
fromPairs: fromPairs,
|
|
561
|
-
concat: concat,
|
|
562
|
-
join: join,
|
|
563
|
-
map: map,
|
|
564
|
-
forEach: forEach,
|
|
565
|
-
both: both,
|
|
566
|
-
isEmpty: isEmpty,
|
|
567
|
-
empty: empty,
|
|
568
|
-
replace: replace,
|
|
569
|
-
filter: filter,
|
|
570
|
-
memoize: memoize,
|
|
571
|
-
mergeShallow: mergeShallow,
|
|
572
|
-
mergeDeep: mergeDeep,
|
|
573
|
-
mergeDeepX: mergeDeepX,
|
|
574
|
-
mergeDeepAdd: mergeDeepAdd,
|
|
575
|
-
overProp: overProp,
|
|
576
|
-
mapKeys: mapKeys,
|
|
577
|
-
forEachSerial: forEachSerial,
|
|
578
|
-
waitAll: waitAll,
|
|
579
|
-
waitTap: waitTap,
|
|
580
|
-
forEachAsync: forEachAsync,
|
|
581
|
-
composeAsync: composeAsync,
|
|
582
|
-
mirror: mirror,
|
|
583
|
-
reflect: reflect,
|
|
584
|
-
echo: echo,
|
|
585
|
-
qappend: qappend,
|
|
586
|
-
qassoc: qassoc,
|
|
587
|
-
qreduce: qreduce,
|
|
588
|
-
qmergeDeep: qmergeDeep,
|
|
589
|
-
qmergeDeepX: qmergeDeepX,
|
|
590
|
-
qmergeDeepAdd: qmergeDeepAdd,
|
|
591
|
-
qmapKeys: qmapKeys,
|
|
592
|
-
qfilter: qfilter,
|
|
593
|
-
qindexOf: qindexOf,
|
|
594
|
-
getTmpl: getTmpl
|
|
595
|
-
});
|
|
596
|
-
|
|
597
|
-
window.pepka = pepka;
|
|
598
|
-
Object.assign(window, pepka);
|
package/dist/bundle.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
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=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&&v(e[s],r[s])))return!1;return!0}return e===r})),P=o(((e,r,t,s)=>e(s)?r(s):t(s))),D=c(((e,r,t)=>P(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(v(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),z=n(((e,r)=>e+r)),F=n(((e,r)=>r-e)),K=n(((e,r)=>e*r)),L=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))),W=n(((e,r)=>(e(r),r))),Y=n(((e,r)=>[...r,e])),Z=n(((e,r)=>r.split(e))),ee=H(!0),re=H(!1),te=n(((e,r)=>oe(z(e),r-e))),se=n(((e,r)=>e.filter(T(C)(r)))),oe=n(((e,r)=>[...Array(r)].map(((r,t)=>e(t))))),pe=n(((e,r)=>e>r)),ne=n(((e,r)=>e<r)),ce=n(((e,r)=>r>=e)),xe=n(((e,r)=>r<=e)),ae=n(((e,r)=>r.sort(e))),ie=n(((e,r)=>r.find(e))),le=n(((e,r)=>r.findIndex(e))),ue=n(((e,r)=>le(v(e),r))),fe=n(((e,r)=>{for(const[t,s]of e)if(t(r))return s(r)})),he=c(((e,r,t)=>({...t,[e]:r}))),de=c(((e,r,t)=>N((s=>{return he(s,G(e)<2?r:de(I(1,a,e),r,(o=t[s],l(o)||"object"!==i(o)?{}:t[s])),t);var o}),U)(e))),me=n(((e,r)=>r.every(e))),ye=n(((e,r)=>r.some(e))),ge=n(((e,r)=>e.every((e=>e(r))))),be=n(((e,r)=>e.some((e=>e(r))))),we=n(((e,r)=>r[e])),je=c(((e,r,t)=>v(t[e],r))),Oe=c(((e,r,t)=>v(r[e],t[e]))),qe=c(((e,r,t)=>P(G,(()=>X(t)?e:N(P(X,H(e),(t=>qe(e,I(1,a,r),t))),T(we)(t),U)(r)),H(t),r))),Ae=qe(x),Ee=c(((e,r,t)=>v(Ae(e,t),r))),ke=c(((e,r,t)=>v(Ae(e,r),Ae(e,t)))),Se=/^(.*?)(8|16|32|64)(Clamped)?Array$/,ve=(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]:Te(ve,e);case"Object":if(r)return{...e};const s={};for(let r in e)s[r]=ve(e[r]);return s;default:return Se.test(t)?e.constructor.from(e):e}},Pe=c(((e,r,t)=>w(e,ve(r),t))),De=n(((e,r)=>Fe(e,r))),Ne=n(((e,r)=>{const t={};for(const s of e)s in r&&(t[s]=r[s]);return t})),Be=n(((e,r)=>Fe(((r,t)=>!C(t,e)),r))),_e=e=>Pe(((e,r)=>he(...r,e)),{},e),Ce=n(((e,r)=>e.concat(r))),Ie=n(((e,r)=>r.join(e))),Te=n(((e,r)=>r.map(e))),Ue=n(((e,r)=>r.forEach(e))),$e=c(((e,r,t)=>r(t)&&e(t))),ze=c(((e,r,t)=>t.replace(e,r))),Fe=n(((e,r)=>f(r)?r.filter(e):N(_e,Fe((([r,t])=>e(t,r))),R)(r))),Ke=n(((e,r)=>Object.assign({},e,r))),Le=n(((e,r)=>O(ve(e),ve(r)))),Xe=n(((e,r)=>q(ve(e),ve(r)))),Ge=n(((e,r)=>A(ve(e),ve(r)))),He=c(((e,r,t)=>he(e,r(t[e]),t))),Je=n(((e,r)=>E(e,Object.assign({},r)))),Me=(()=>{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)))})(),Qe=n((async(e,r)=>(await e(r),r))),Re=n(((e,r)=>Promise.all(r.map(e)))),Ve=(()=>{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)})(),We=J,Ye=J,Ze=J;exports.F=re,exports.T=ee,exports.__=e,exports.add=z,exports.all=me,exports.allPass=ge,exports.always=H,exports.any=ye,exports.anyPass=be,exports.append=Y,exports.assoc=he,exports.assocPath=de,exports.bind=B,exports.both=$e,exports.clone=ve,exports.cloneShallow=e=>ve(e,!0),exports.complement=Q,exports.compose=N,exports.composeAsync=Ve,exports.concat=Ce,exports.cond=fe,exports.curry=o,exports.curry2=n,exports.curry3=c,exports.divide=L,exports.echo=Ze,exports.empty=e=>{switch(m(e)){case"String":return"";case"Object":return{};case"Array":return[];default:return x}},exports.equals=v,exports.explore=(e,r="log")=>W((t=>console[r](e,t))),exports.filter=Fe,exports.find=ie,exports.findIndex=le,exports.flip=T,exports.forEach=Ue,exports.forEachAsync=Re,exports.forEachSerial=Me,exports.fromPairs=_e,exports.genBy=oe,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(Ae(t[c].split("."),e));return s.join("")}},exports.gt=pe,exports.gte=ce,exports.head=U,exports.identity=J,exports.ifElse=P,exports.includes=C,exports.indexOf=ue,exports.intersection=se,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=Ie,exports.keys=e=>Object.keys(e),exports.last=e=>e[G(e)-1],exports.length=G,exports.lt=ne,exports.lte=xe,exports.map=Te,exports.mapKeys=Je,exports.memoize=e=>{let r,t=!1;return()=>t?r:(t=!0,r=e())},exports.mergeDeep=Le,exports.mergeDeepAdd=Ge,exports.mergeDeepX=Xe,exports.mergeShallow=Ke,exports.mirror=We,exports.multiply=K,exports.not=M,exports.nth=_,exports.omit=Be,exports.once=e=>{let r,t=!1;return(...s)=>t?r:(t=!0,r=e(...s))},exports.overProp=He,exports.path=Ae,exports.pathEq=Ee,exports.pathOr=qe,exports.pathsEq=ke,exports.pick=Ne,exports.pickBy=De,exports.prop=we,exports.propEq=je,exports.propsEq=Oe,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=te,exports.reduce=Pe,exports.reflect=Ye,exports.replace=ze,exports.reverse=e=>N((r=>Pe(((t,s,o)=>g(e[r-o],t)),[],e)),z(-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=ae,exports.split=Z,exports.subtract=F,exports.tail=$,exports.take=e=>(...r)=>r[e],exports.tap=W,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=Qe,exports.when=D;
|