pepka 0.13.0-b5 → 0.13.0-b7
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.d.ts +38 -154
- package/package.json +1 -1
- package/src/curry.ts +3 -3
- package/src/safe.ts +3 -3
- package/src/uncurry.ts +1 -1
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;
|
|
@@ -33,8 +32,8 @@ export declare const equals: {
|
|
|
33
32
|
(a: any): (b: any) => boolean;
|
|
34
33
|
(a: any, b: any): boolean;
|
|
35
34
|
};
|
|
36
|
-
export declare const ifElse:
|
|
37
|
-
export declare const when:
|
|
35
|
+
export declare const ifElse: (...args: AnyArgs) => any;
|
|
36
|
+
export declare const when: (...args: AnyArgs) => any;
|
|
38
37
|
export declare const compose: FT.Compose;
|
|
39
38
|
export declare const bind: {
|
|
40
39
|
(a: symbol, b: any): (a: any) => any;
|
|
@@ -54,9 +53,9 @@ export declare const includes: {
|
|
|
54
53
|
(a: unknown): (b: unknown[]) => boolean;
|
|
55
54
|
(a: unknown, b: unknown[]): boolean;
|
|
56
55
|
};
|
|
57
|
-
export declare const slice:
|
|
56
|
+
export declare const slice: (...args: AnyArgs) => any;
|
|
58
57
|
export declare const head: (b: string | unknown[]) => unknown;
|
|
59
|
-
export declare const tail:
|
|
58
|
+
export declare const tail: any;
|
|
60
59
|
export declare const add: {
|
|
61
60
|
(a: symbol, b: number): (a: number) => number;
|
|
62
61
|
(a: number, b: symbol): (b: number) => number;
|
|
@@ -69,7 +68,7 @@ export declare const subtract: {
|
|
|
69
68
|
(a: number): (b: number) => number;
|
|
70
69
|
(a: number, b: number): number;
|
|
71
70
|
};
|
|
72
|
-
export declare const flip: (fn: Function) =>
|
|
71
|
+
export declare const flip: (fn: Function) => (...args: AnyArgs) => any;
|
|
73
72
|
export declare const isNil: (s: any) => boolean;
|
|
74
73
|
export declare const length: (s: any[] | string) => number;
|
|
75
74
|
export declare const always: <T = any>(s: T) => () => T;
|
|
@@ -131,10 +130,7 @@ export declare const genBy: {
|
|
|
131
130
|
(a: (i: number) => any, b: number): any[];
|
|
132
131
|
};
|
|
133
132
|
export declare const once: <Func extends AnyFunc<any, AnyArgs>>(fn: Func) => (...args: Parameters<Func>) => any;
|
|
134
|
-
export declare const reverse: (xs: any[]) =>
|
|
135
|
-
] | [
|
|
136
|
-
accum: any
|
|
137
|
-
]) => any>>;
|
|
133
|
+
export declare const reverse: (xs: any[]) => any;
|
|
138
134
|
export declare const gt: {
|
|
139
135
|
(a: symbol, b: number): (a: number) => boolean;
|
|
140
136
|
(a: number, b: symbol): (b: number) => boolean;
|
|
@@ -202,9 +198,7 @@ export declare const cond: {
|
|
|
202
198
|
Function
|
|
203
199
|
][], b: any): any;
|
|
204
200
|
};
|
|
205
|
-
export declare const assoc:
|
|
206
|
-
[x: string]: any;
|
|
207
|
-
}>;
|
|
201
|
+
export declare const assoc: (...args: AnyArgs) => any;
|
|
208
202
|
export declare const assocPath: any;
|
|
209
203
|
export declare const all: {
|
|
210
204
|
(a: symbol, b: any[]): (a: Cond) => boolean;
|
|
@@ -236,18 +230,15 @@ export declare const prop: {
|
|
|
236
230
|
(a: string): (b: AnyObject) => any;
|
|
237
231
|
(a: string, b: AnyObject): any;
|
|
238
232
|
};
|
|
239
|
-
export declare const propEq:
|
|
240
|
-
export declare const propsEq:
|
|
241
|
-
export declare const pathOr:
|
|
242
|
-
export declare const path:
|
|
243
|
-
export declare const pathEq:
|
|
244
|
-
export declare const pathsEq:
|
|
233
|
+
export declare const propEq: (...args: AnyArgs) => any;
|
|
234
|
+
export declare const propsEq: (...args: AnyArgs) => any;
|
|
235
|
+
export declare const pathOr: (...args: AnyArgs) => any;
|
|
236
|
+
export declare const path: any;
|
|
237
|
+
export declare const pathEq: (...args: AnyArgs) => any;
|
|
238
|
+
export declare const pathsEq: (...args: AnyArgs) => any;
|
|
245
239
|
export declare const clone: (s: any, shallow?: boolean) => any;
|
|
246
240
|
export declare const cloneShallow: (s: any) => any;
|
|
247
|
-
export declare const reduce:
|
|
248
|
-
] | [
|
|
249
|
-
accum: any
|
|
250
|
-
]) => any>>;
|
|
241
|
+
export declare const reduce: (...args: AnyArgs) => any;
|
|
251
242
|
export declare const pickBy: {
|
|
252
243
|
(a: symbol, b: AnyObject): (a: Cond) => any;
|
|
253
244
|
(a: Cond, b: symbol): (b: AnyObject) => any;
|
|
@@ -269,10 +260,7 @@ export declare const omit: {
|
|
|
269
260
|
export declare const fromPairs: (pairs: [
|
|
270
261
|
string,
|
|
271
262
|
any
|
|
272
|
-
][]) =>
|
|
273
|
-
] | [
|
|
274
|
-
accum: any
|
|
275
|
-
]) => any>>;
|
|
263
|
+
][]) => any;
|
|
276
264
|
export declare const concat: {
|
|
277
265
|
(a: symbol, b: string | any[]): (a: string | any[]) => string | any[];
|
|
278
266
|
(a: string | any[], b: symbol): (b: string | any[]) => string | any[];
|
|
@@ -297,10 +285,10 @@ export declare const forEach: {
|
|
|
297
285
|
(a: (s: any) => any): (b: any[]) => void;
|
|
298
286
|
(a: (s: any) => any, b: any[]): void;
|
|
299
287
|
};
|
|
300
|
-
export declare const both:
|
|
288
|
+
export declare const both: (...args: AnyArgs) => any;
|
|
301
289
|
export declare const isEmpty: (s: any) => boolean | null;
|
|
302
290
|
export declare const empty: (s: any) => {} | undefined;
|
|
303
|
-
export declare const replace:
|
|
291
|
+
export declare const replace: (...args: AnyArgs) => any;
|
|
304
292
|
export declare const filter: any;
|
|
305
293
|
export declare const memoize: (fn: Function) => () => any;
|
|
306
294
|
export declare const mergeShallow: {
|
|
@@ -310,128 +298,24 @@ export declare const mergeShallow: {
|
|
|
310
298
|
(a: AnyObject, b: AnyObject): AnyObject;
|
|
311
299
|
};
|
|
312
300
|
export declare const mergeDeep: {
|
|
313
|
-
(a: symbol, b: AnyObject): (a: AnyObject) =>
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
] | [
|
|
318
|
-
o2: AnyObject
|
|
319
|
-
] | [
|
|
320
|
-
o1: AnyObject
|
|
321
|
-
]) => any>;
|
|
322
|
-
(a: AnyObject, b: symbol): (b: AnyObject) => FT.Curry<(...p: [
|
|
323
|
-
] | [
|
|
324
|
-
o1: AnyObject,
|
|
325
|
-
o2: AnyObject
|
|
326
|
-
] | [
|
|
327
|
-
o2: AnyObject
|
|
328
|
-
] | [
|
|
329
|
-
o1: AnyObject
|
|
330
|
-
]) => any>;
|
|
331
|
-
(a: AnyObject): (b: AnyObject) => FT.Curry<(...p: [
|
|
332
|
-
] | [
|
|
333
|
-
o1: AnyObject,
|
|
334
|
-
o2: AnyObject
|
|
335
|
-
] | [
|
|
336
|
-
o2: AnyObject
|
|
337
|
-
] | [
|
|
338
|
-
o1: AnyObject
|
|
339
|
-
]) => any>;
|
|
340
|
-
(a: AnyObject, b: AnyObject): FT.Curry<(...p: [
|
|
341
|
-
] | [
|
|
342
|
-
o1: AnyObject,
|
|
343
|
-
o2: AnyObject
|
|
344
|
-
] | [
|
|
345
|
-
o2: AnyObject
|
|
346
|
-
] | [
|
|
347
|
-
o1: AnyObject
|
|
348
|
-
]) => any>;
|
|
301
|
+
(a: symbol, b: AnyObject): (a: AnyObject) => any;
|
|
302
|
+
(a: AnyObject, b: symbol): (b: AnyObject) => any;
|
|
303
|
+
(a: AnyObject): (b: AnyObject) => any;
|
|
304
|
+
(a: AnyObject, b: AnyObject): any;
|
|
349
305
|
};
|
|
350
306
|
export declare const mergeDeepX: {
|
|
351
|
-
(a: symbol, b: AnyObject): (a: AnyObject) =>
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
] | [
|
|
356
|
-
o2: AnyObject
|
|
357
|
-
] | [
|
|
358
|
-
o1: AnyObject
|
|
359
|
-
]) => any>;
|
|
360
|
-
(a: AnyObject, b: symbol): (b: AnyObject) => FT.Curry<(...p: [
|
|
361
|
-
] | [
|
|
362
|
-
o1: AnyObject,
|
|
363
|
-
o2: AnyObject
|
|
364
|
-
] | [
|
|
365
|
-
o2: AnyObject
|
|
366
|
-
] | [
|
|
367
|
-
o1: AnyObject
|
|
368
|
-
]) => any>;
|
|
369
|
-
(a: AnyObject): (b: AnyObject) => FT.Curry<(...p: [
|
|
370
|
-
] | [
|
|
371
|
-
o1: AnyObject,
|
|
372
|
-
o2: AnyObject
|
|
373
|
-
] | [
|
|
374
|
-
o2: AnyObject
|
|
375
|
-
] | [
|
|
376
|
-
o1: AnyObject
|
|
377
|
-
]) => any>;
|
|
378
|
-
(a: AnyObject, b: AnyObject): FT.Curry<(...p: [
|
|
379
|
-
] | [
|
|
380
|
-
o1: AnyObject,
|
|
381
|
-
o2: AnyObject
|
|
382
|
-
] | [
|
|
383
|
-
o2: AnyObject
|
|
384
|
-
] | [
|
|
385
|
-
o1: AnyObject
|
|
386
|
-
]) => any>;
|
|
307
|
+
(a: symbol, b: AnyObject): (a: AnyObject) => any;
|
|
308
|
+
(a: AnyObject, b: symbol): (b: AnyObject) => any;
|
|
309
|
+
(a: AnyObject): (b: AnyObject) => any;
|
|
310
|
+
(a: AnyObject, b: AnyObject): any;
|
|
387
311
|
};
|
|
388
312
|
export declare const mergeDeepAdd: {
|
|
389
|
-
(a: symbol, b: AnyObject): (a: AnyObject) =>
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
] | [
|
|
396
|
-
o1: AnyObject
|
|
397
|
-
]) => any>;
|
|
398
|
-
(a: AnyObject, b: symbol): (b: AnyObject) => FT.Curry<(...p: [
|
|
399
|
-
] | [
|
|
400
|
-
o1: AnyObject,
|
|
401
|
-
o2: AnyObject
|
|
402
|
-
] | [
|
|
403
|
-
o2: AnyObject
|
|
404
|
-
] | [
|
|
405
|
-
o1: AnyObject
|
|
406
|
-
]) => any>;
|
|
407
|
-
(a: AnyObject): (b: AnyObject) => FT.Curry<(...p: [
|
|
408
|
-
] | [
|
|
409
|
-
o1: AnyObject,
|
|
410
|
-
o2: AnyObject
|
|
411
|
-
] | [
|
|
412
|
-
o2: AnyObject
|
|
413
|
-
] | [
|
|
414
|
-
o1: AnyObject
|
|
415
|
-
]) => any>;
|
|
416
|
-
(a: AnyObject, b: AnyObject): FT.Curry<(...p: [
|
|
417
|
-
] | [
|
|
418
|
-
o1: AnyObject,
|
|
419
|
-
o2: AnyObject
|
|
420
|
-
] | [
|
|
421
|
-
o2: AnyObject
|
|
422
|
-
] | [
|
|
423
|
-
o1: AnyObject
|
|
424
|
-
]) => any>;
|
|
425
|
-
};
|
|
426
|
-
export declare const overProp: FT.Curry<(prop: string, pipe: AnyFunc, data: any) => FT.Curry<(...p: [
|
|
427
|
-
] | [
|
|
428
|
-
v: any,
|
|
429
|
-
obj: AnyObject
|
|
430
|
-
] | [
|
|
431
|
-
obj: AnyObject
|
|
432
|
-
] | [
|
|
433
|
-
v: any
|
|
434
|
-
]) => any>>;
|
|
313
|
+
(a: symbol, b: AnyObject): (a: AnyObject) => any;
|
|
314
|
+
(a: AnyObject, b: symbol): (b: AnyObject) => any;
|
|
315
|
+
(a: AnyObject): (b: AnyObject) => any;
|
|
316
|
+
(a: AnyObject, b: AnyObject): any;
|
|
317
|
+
};
|
|
318
|
+
export declare const overProp: (...args: AnyArgs) => any;
|
|
435
319
|
/** mapKeys({ a: 'b' }, { a: 44 }) -> { b: 44 } */
|
|
436
320
|
export declare const mapKeys: {
|
|
437
321
|
(a: symbol, b: AnyObject): (a: {
|
|
@@ -480,11 +364,11 @@ export declare const qappend: {
|
|
|
480
364
|
(a: any): (b: any[]) => any[];
|
|
481
365
|
(a: any, b: any[]): any[];
|
|
482
366
|
};
|
|
483
|
-
export declare const qassoc:
|
|
484
|
-
export declare const qreduce:
|
|
485
|
-
export declare const qmergeDeep:
|
|
486
|
-
export declare const qmergeDeepX:
|
|
487
|
-
export declare const qmergeDeepAdd:
|
|
367
|
+
export declare const qassoc: (...args: AnyArgs) => any;
|
|
368
|
+
export declare const qreduce: (...args: AnyArgs) => any;
|
|
369
|
+
export declare const qmergeDeep: any;
|
|
370
|
+
export declare const qmergeDeepX: any;
|
|
371
|
+
export declare const qmergeDeepAdd: any;
|
|
488
372
|
/** qmapKeys({ a: 'b' }, { a: 44 }) -> { b: 44 } */
|
|
489
373
|
export declare const qmapKeys: {
|
|
490
374
|
(a: symbol, b: AnyObject): (a: {
|
package/package.json
CHANGED
package/src/curry.ts
CHANGED
|
@@ -46,11 +46,11 @@ const _curry = (fn: Function, args: AnyArgs, new_args: AnyArgs) => {
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
export const curry = (
|
|
49
|
-
|
|
49
|
+
/*<Func extends AnyFunc>*/(fn: AnyFunc) => (
|
|
50
50
|
(...args: AnyArgs) => fn.length>countArgs(args)
|
|
51
51
|
? _curry(fn, [], args)
|
|
52
52
|
: fn(...args)
|
|
53
|
-
) as FT.Curry<Func>
|
|
53
|
+
)// as FT.Curry<Func>
|
|
54
54
|
)
|
|
55
55
|
const endlessph = <Func extends FT.Function>(fn: Func) => {
|
|
56
56
|
type ReturnT = ReturnType<Func>
|
|
@@ -93,5 +93,5 @@ export function curry3<Func extends Func3>(fn: Func) {
|
|
|
93
93
|
// type p2 = Parameters<Func>[2]
|
|
94
94
|
// type ReturnT = ReturnType<Func>
|
|
95
95
|
// TODO: optimize.
|
|
96
|
-
return curry(fn) as FT.Curry<Func>
|
|
96
|
+
return curry(fn)// as FT.Curry<Func>
|
|
97
97
|
}
|
package/src/safe.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __, curry, curry2, curry3 } from './curry'
|
|
2
|
-
import { isNum,
|
|
2
|
+
import { isNum, isUndef, undef, isNull, isArray, isFunc, isStr, isObj, inf } from './utils'
|
|
3
3
|
import { qmergeDeep, qreduce, qappend, qmapKeys, qmergeDeepX, qmergeDeepAdd } from './quick'
|
|
4
4
|
import { AnyFunc, Cond, AnyObject, Reducer } from './types'
|
|
5
5
|
import { type } from './common'
|
|
@@ -139,7 +139,7 @@ export const once = <Func extends AnyFunc>(fn: Func) => {
|
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
141
|
export const reverse = (xs: any[]) => compose(
|
|
142
|
-
<T>(ln: number) => reduce
|
|
142
|
+
<T>(ln: number) => reduce(
|
|
143
143
|
(nxs: T[], _: any, i: number) => qappend(xs[ln-i], nxs),
|
|
144
144
|
[], xs
|
|
145
145
|
),
|
|
@@ -269,7 +269,7 @@ export const omit = curry2(
|
|
|
269
269
|
o
|
|
270
270
|
)
|
|
271
271
|
)
|
|
272
|
-
export const fromPairs = (pairs: [string, any][]) => reduce
|
|
272
|
+
export const fromPairs = (pairs: [string, any][]) => reduce(
|
|
273
273
|
(o: AnyObject, pair: [string, any]) => assoc(...pair, o),
|
|
274
274
|
{}, pairs
|
|
275
275
|
)
|
package/src/uncurry.ts
CHANGED