rambda 8.2.0 → 8.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +34 -0
- package/README.md +523 -334
- package/dist/rambda.js +286 -279
- package/dist/rambda.umd.js +1 -1
- package/immutable.d.ts +83 -31
- package/index.d.ts +83 -31
- package/package.json +106 -105
- package/rambda.js +7 -0
- package/src/_internals/_arity.js +64 -0
- package/src/_internals/compare.js +3 -0
- package/src/_internals/createPath.js +5 -1
- package/src/_internals/createPathInput.js +7 -0
- package/src/_internals/includes.js +12 -0
- package/src/_internals/isInteger.js +5 -0
- package/src/assoc.js +1 -1
- package/src/assocPath.js +9 -13
- package/src/binary.js +5 -0
- package/src/call.js +1 -0
- package/src/collectBy.js +27 -0
- package/src/comparator.js +5 -0
- package/src/composeWith.js +33 -0
- package/src/curryN.js +2 -65
- package/src/dissocPath.js +47 -0
- package/src/equals.js +40 -52
- package/src/omit.js +4 -6
- package/src/partial.js +9 -3
- package/src/pipe.js +1 -67
- package/src/removeIndex.js +7 -0
package/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export type RambdaTypes = "Object" | "Number" | "Boolean" | "String" | "Null" | "Array" | "RegExp" | "NaN" | "Function" | "Undefined" | "Async" | "Promise" | "Symbol" | "Set" | "Error" | "Map" | "WeakMap" | "Generator" | "GeneratorFunction" | "BigInt" | "ArrayBuffer" | "Date"
|
|
2
2
|
|
|
3
|
-
|
|
4
3
|
type LastArrayElement<ValueType extends readonly unknown[]> =
|
|
5
4
|
ValueType extends readonly [infer ElementType]
|
|
6
5
|
? ElementType
|
|
@@ -95,6 +94,9 @@ interface AssocPartialOne<K extends keyof any> {
|
|
|
95
94
|
<T>(val: T): <U>(obj: U) => Record<K, T> & U;
|
|
96
95
|
<T, U>(val: T, obj: U): Record<K, T> & U;
|
|
97
96
|
}
|
|
97
|
+
type AtLeastOneFunctionsFlowFromRightToLeft<TArgs extends any[], TResult> =
|
|
98
|
+
| [(...args: any) => TResult, ...Array<(args: any) => any>, (...args: TArgs) => any]
|
|
99
|
+
| [(...args: TArgs) => TResult];
|
|
98
100
|
|
|
99
101
|
type AnyFunction = (...args: any[]) => unknown;
|
|
100
102
|
type AnyConstructor = new (...args: any[]) => unknown;
|
|
@@ -112,6 +114,9 @@ type RegExpReplacerFn =
|
|
|
112
114
|
| ((m: string, p1: string, p2: string, p3: string, p4: string, p5: string, p6: string, p7: string, p8: string, p9: string, offset: number, s: string, groups?: Record<string, string>) => string)
|
|
113
115
|
type RegExpReplacer = string | RegExpReplacerFn
|
|
114
116
|
|
|
117
|
+
/** `TSuper`, when `TSuper` is a supertype of `T`; otherwise `never`. */
|
|
118
|
+
type IsFirstSubtypeOfSecond<First, Second> = (First extends Second ? Second : never);
|
|
119
|
+
|
|
115
120
|
// RAMBDAX INTERFACES
|
|
116
121
|
// ============================================
|
|
117
122
|
type Func<T> = (input: any) => T;
|
|
@@ -226,6 +231,7 @@ export function any<T>(predicate: (x: T) => boolean): (list: T[]) => boolean;
|
|
|
226
231
|
/**
|
|
227
232
|
* It accepts list of `predicates` and returns a function. This function with its `input` will return `true`, if any of `predicates` returns `true` for this `input`.
|
|
228
233
|
*/
|
|
234
|
+
export function anyPass<T, U extends T[]>(predicates: { [K in keyof U]: (x: T) => x is U[K]; }): (input: T) => input is U[number];
|
|
229
235
|
export function anyPass<T>(predicates: ((x: T) => boolean)[]): (input: T) => boolean;
|
|
230
236
|
export function anyPass<T>(predicates: ((...inputs: T[]) => boolean)[]): (...inputs: T[]) => boolean;
|
|
231
237
|
|
|
@@ -237,10 +243,12 @@ export function aperture<N extends number, T>(n: N, list: T[]): Array<Tuple<T, N
|
|
|
237
243
|
export function aperture<N extends number>(n: N): <T>(list: T[]) => Array<Tuple<T, N>> | [];
|
|
238
244
|
|
|
239
245
|
/**
|
|
240
|
-
* It adds element `x` at the end of `
|
|
246
|
+
* It adds element `x` at the end of `iterable`.
|
|
241
247
|
*/
|
|
242
|
-
export function append<T>(
|
|
243
|
-
export function append<T>(
|
|
248
|
+
export function append<T>(xToAppend: T, iterable: T[]): T[];
|
|
249
|
+
export function append<T, U>(xToAppend: T, iterable: IsFirstSubtypeOfSecond<T, U>[]) : U[];
|
|
250
|
+
export function append<T>(xToAppend: T): <U>(iterable: IsFirstSubtypeOfSecond<T, U>[]) => U[];
|
|
251
|
+
export function append<T>(xToAppend: T): (iterable: T[]) => T[];
|
|
244
252
|
|
|
245
253
|
/**
|
|
246
254
|
* It applies function `fn` to the list of arguments.
|
|
@@ -277,6 +285,8 @@ export function assocPath<Output>(path: Path, newValue: any, obj: object): Outpu
|
|
|
277
285
|
export function assocPath<Output>(path: Path, newValue: any): (obj: object) => Output;
|
|
278
286
|
export function assocPath<Output>(path: Path): (newValue: any) => (obj: object) => Output;
|
|
279
287
|
|
|
288
|
+
export function binary<T extends (...arg: any[]) => any>(fn: T): (...args: any[]) => ReturnType<T>;
|
|
289
|
+
|
|
280
290
|
/**
|
|
281
291
|
* Creates a function that is bound to a context.
|
|
282
292
|
*/
|
|
@@ -293,6 +303,8 @@ export function both<T>(pred1: Predicate<T>, pred2: Predicate<T>): Predicate<T>;
|
|
|
293
303
|
export function both<T>(pred1: Predicate<T>): (pred2: Predicate<T>) => Predicate<T>;
|
|
294
304
|
export function both(pred1: Pred): (pred2: Pred) => Pred;
|
|
295
305
|
|
|
306
|
+
export function call<T extends (...args: any[]) => any>(fn: T, ...args: Parameters<T>): ReturnType<T>;
|
|
307
|
+
|
|
296
308
|
/**
|
|
297
309
|
* The method is also known as `flatMap`.
|
|
298
310
|
*/
|
|
@@ -315,6 +327,11 @@ export function clamp(min: number, max: number): (input: number) => number;
|
|
|
315
327
|
export function clone<T>(input: T): T;
|
|
316
328
|
export function clone<T>(input: T[]): T[];
|
|
317
329
|
|
|
330
|
+
export function collectBy<T, K extends PropertyKey>(keyFn: (value: T) => K, list: T[]): T[][];
|
|
331
|
+
export function collectBy<T, K extends PropertyKey>(keyFn: (value: T) => K): (list: T[]) => T[][];
|
|
332
|
+
|
|
333
|
+
export function comparator<T>(pred: (a: T, b: T) => boolean): (x: T, y: T) => Ordering;
|
|
334
|
+
|
|
318
335
|
/**
|
|
319
336
|
* It returns `inverted` version of `origin` function that accept `input` as argument.
|
|
320
337
|
*
|
|
@@ -390,6 +407,16 @@ export function compose<TArgs extends any[], R1>(
|
|
|
390
407
|
f1: (...args: TArgs) => R1
|
|
391
408
|
): (...args: TArgs) => R1;
|
|
392
409
|
|
|
410
|
+
export function composeWith<TArgs extends any[], TResult>(
|
|
411
|
+
transformer: (fn: (...args: any[]) => any, intermediatResult: any) => any,
|
|
412
|
+
fns: AtLeastOneFunctionsFlowFromRightToLeft<TArgs, TResult>,
|
|
413
|
+
): (...args: TArgs) => TResult;
|
|
414
|
+
export function composeWith(
|
|
415
|
+
transformer: (fn: (...args: any[]) => any, intermediatResult: any) => any,
|
|
416
|
+
): <TArgs extends any[], TResult>(
|
|
417
|
+
fns: AtLeastOneFunctionsFlowFromRightToLeft<TArgs, TResult>,
|
|
418
|
+
) => (...args: TArgs) => TResult;
|
|
419
|
+
|
|
393
420
|
/**
|
|
394
421
|
* It returns a new string or array, which is the result of merging `x` and `y`.
|
|
395
422
|
*/
|
|
@@ -479,6 +506,8 @@ export function differenceWith<T1, T2>(
|
|
|
479
506
|
export function dissoc<T extends object, K extends keyof T>(prop: K, obj: T): Omit<T, K>;
|
|
480
507
|
export function dissoc<K extends string | number>(prop: K): <T extends object>(obj: T) => Omit<T, K>;
|
|
481
508
|
|
|
509
|
+
export function dissocPath<T>(x: T): T;
|
|
510
|
+
|
|
482
511
|
export function divide(x: number, y: number): number;
|
|
483
512
|
export function divide(x: number): (y: number) => number;
|
|
484
513
|
|
|
@@ -659,8 +688,10 @@ export function hasPath<T>(
|
|
|
659
688
|
/**
|
|
660
689
|
* It returns the first element of list or string `input`.
|
|
661
690
|
*/
|
|
662
|
-
export function head(
|
|
663
|
-
export function head(
|
|
691
|
+
export function head(str: string): string;
|
|
692
|
+
export function head(str: ''): undefined;
|
|
693
|
+
export function head<T>(list: never[]): undefined;
|
|
694
|
+
export function head<T extends unknown[]>(array: T): FirstArrayElement<T>
|
|
664
695
|
export function head<T extends readonly unknown[]>(array: T): FirstArrayElement<T>
|
|
665
696
|
|
|
666
697
|
/**
|
|
@@ -780,14 +811,16 @@ export function juxt<A extends any[], U>(fns: Array<(...args: A) => U>): (...arg
|
|
|
780
811
|
/**
|
|
781
812
|
* It applies `Object.keys` over `x` and returns its keys.
|
|
782
813
|
*/
|
|
783
|
-
export function keys<T extends object>(x: T): (keyof T)[];
|
|
814
|
+
export function keys<T extends object>(x: T): (keyof T & string)[];
|
|
784
815
|
export function keys<T>(x: T): string[];
|
|
785
816
|
|
|
786
817
|
/**
|
|
787
818
|
* It returns the last element of `input`, as the `input` can be either a string or an array.
|
|
788
819
|
*/
|
|
789
|
-
export function last(
|
|
790
|
-
export function last(
|
|
820
|
+
export function last(str: ''): undefined;
|
|
821
|
+
export function last(str: string): string;
|
|
822
|
+
export function last(list: never[]): undefined;
|
|
823
|
+
export function last<T extends unknown[]>(array: T): LastArrayElement<T>
|
|
791
824
|
export function last<T extends readonly unknown[]>(array: T): LastArrayElement<T>
|
|
792
825
|
|
|
793
826
|
/**
|
|
@@ -1063,13 +1096,31 @@ export function over(lens: Lens): <T>(fn: Arity1Fn, value: T[]) => T[];
|
|
|
1063
1096
|
* `R.partial` will keep returning a function until all the arguments that the function `fn` expects are passed.
|
|
1064
1097
|
* The name comes from the fact that you partially inject the inputs.
|
|
1065
1098
|
*/
|
|
1066
|
-
export function partial<
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1099
|
+
export function partial<
|
|
1100
|
+
Args extends unknown[],
|
|
1101
|
+
ArgsGiven extends [...Partial<Args>],
|
|
1102
|
+
R
|
|
1103
|
+
>(
|
|
1104
|
+
fn: (...args: Args) => R,
|
|
1105
|
+
...args: ArgsGiven
|
|
1106
|
+
): Args extends [...{[K in keyof ArgsGiven]: Args[K]}, ...infer ArgsRemaining]
|
|
1107
|
+
? ArgsRemaining extends []
|
|
1108
|
+
? R
|
|
1109
|
+
: (...args: ArgsRemaining) => R
|
|
1110
|
+
: never;
|
|
1111
|
+
|
|
1112
|
+
export function partial<
|
|
1113
|
+
Args extends readonly unknown[],
|
|
1114
|
+
ArgsGiven extends [...Partial<Args>],
|
|
1115
|
+
R
|
|
1116
|
+
>(
|
|
1117
|
+
fn: (...args: Args) => R,
|
|
1118
|
+
args: ArgsGiven
|
|
1119
|
+
): Args extends [...{[K in keyof ArgsGiven]: Args[K]}, ...infer ArgsRemaining]
|
|
1120
|
+
? ArgsRemaining extends []
|
|
1121
|
+
? R
|
|
1122
|
+
: (...args: ArgsRemaining) => R
|
|
1123
|
+
: never;
|
|
1073
1124
|
|
|
1074
1125
|
/**
|
|
1075
1126
|
* `R.partialObject` is a curry helper designed specifically for functions accepting object as a single argument.
|
|
@@ -1260,8 +1311,10 @@ export function pluck(property: number): <T>(list: { [k: number]: T }[]) => T[];
|
|
|
1260
1311
|
/**
|
|
1261
1312
|
* It adds element `x` at the beginning of `list`.
|
|
1262
1313
|
*/
|
|
1263
|
-
export function prepend<T>(
|
|
1264
|
-
export function prepend<T>(
|
|
1314
|
+
export function prepend<T>(xToPrepend: T, iterable: T[]): T[];
|
|
1315
|
+
export function prepend<T, U>(xToPrepend: T, iterable: IsFirstSubtypeOfSecond<T, U>[]) : U[];
|
|
1316
|
+
export function prepend<T>(xToPrepend: T): <U>(iterable: IsFirstSubtypeOfSecond<T, U>[]) => U[];
|
|
1317
|
+
export function prepend<T>(xToPrepend: T): (iterable: T[]) => T[];
|
|
1265
1318
|
|
|
1266
1319
|
export function product(list: number[]): number;
|
|
1267
1320
|
|
|
@@ -1270,17 +1323,10 @@ export function product(list: number[]): number;
|
|
|
1270
1323
|
*
|
|
1271
1324
|
* If there is no such property, it returns `undefined`.
|
|
1272
1325
|
*/
|
|
1273
|
-
export function prop<P extends keyof never, T>(
|
|
1274
|
-
export function prop<
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
};
|
|
1278
|
-
export function prop<P extends keyof T, T>(propToFind: P): {
|
|
1279
|
-
(value: T): Prop<T, P>;
|
|
1280
|
-
};
|
|
1281
|
-
export function prop<P extends keyof never, T>(propToFind: P): {
|
|
1282
|
-
(value: Record<P, T>): T;
|
|
1283
|
-
};
|
|
1326
|
+
export function prop<_, P extends keyof never, T>(p: P, value: T): Prop<T, P>;
|
|
1327
|
+
export function prop<V>(p: keyof never, value: unknown): V;
|
|
1328
|
+
export function prop<_, P extends keyof never>(p: P): <T>(value: T) => Prop<T, P>;
|
|
1329
|
+
export function prop<V>(p: keyof never): (value: unknown) => V;
|
|
1284
1330
|
|
|
1285
1331
|
/**
|
|
1286
1332
|
* It returns true if `obj` has property `propToFind` and its value is equal to `valueToMatch`.
|
|
@@ -1335,8 +1381,8 @@ export function range(startInclusive: number): (endExclusive: number) => number[
|
|
|
1335
1381
|
|
|
1336
1382
|
export function reduce<T, TResult>(reducer: (prev: TResult, current: T, i: number) => TResult, initialValue: TResult, list: T[]): TResult;
|
|
1337
1383
|
export function reduce<T, TResult>(reducer: (prev: TResult, current: T) => TResult, initialValue: TResult, list: T[]): TResult;
|
|
1338
|
-
export function reduce<T, TResult>(reducer: (prev: TResult, current: T, i
|
|
1339
|
-
export function reduce<T, TResult>(reducer: (prev: TResult, current: T, i
|
|
1384
|
+
export function reduce<T, TResult>(reducer: (prev: TResult, current: T, i: number) => TResult): (initialValue: TResult, list: T[]) => TResult;
|
|
1385
|
+
export function reduce<T, TResult>(reducer: (prev: TResult, current: T, i: number) => TResult, initialValue: TResult): (list: T[]) => TResult;
|
|
1340
1386
|
|
|
1341
1387
|
/**
|
|
1342
1388
|
* It has the opposite effect of `R.filter`.
|
|
@@ -1346,6 +1392,12 @@ export function reject<T>(predicate: Predicate<T>): (list: T[]) => T[];
|
|
|
1346
1392
|
export function reject<T>(predicate: Predicate<T>, obj: Dictionary<T>): Dictionary<T>;
|
|
1347
1393
|
export function reject<T, U>(predicate: Predicate<T>): (obj: Dictionary<T>) => Dictionary<T>;
|
|
1348
1394
|
|
|
1395
|
+
/**
|
|
1396
|
+
* It returns a copy of `list` input with removed `index`.
|
|
1397
|
+
*/
|
|
1398
|
+
export function removeIndex<T>(index: number, list: T[]): T[];
|
|
1399
|
+
export function removeIndex(index: number): <T>(list: T[]) => T[];
|
|
1400
|
+
|
|
1349
1401
|
export function repeat<T>(x: T): (timesToRepeat: number) => T[];
|
|
1350
1402
|
export function repeat<T>(x: T, timesToRepeat: number): T[];
|
|
1351
1403
|
|
package/package.json
CHANGED
|
@@ -1,107 +1,108 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
2
|
+
"name": "rambda",
|
|
3
|
+
"version": "8.4.0",
|
|
4
|
+
"scripts": {
|
|
5
|
+
"benchmark": "cd ../rambda-scripts && RAMBDA_RUN_ALL=ON RAMBDA_RUN_INDEXES=ON yarn benchmark",
|
|
6
|
+
"benchmark:all": "yarn build:step && cd ../rambda-scripts && yarn benchmark:all",
|
|
7
|
+
"benchmark:check": "yarn build:step && METHOD=compose yarn benchmark:check:apply",
|
|
8
|
+
"benchmark:check:apply": "cd ../rambda-scripts && yarn check-benchmark",
|
|
9
|
+
"build": "yarn build:main && yarn build:web",
|
|
10
|
+
"build:main": "cross-env NODE_ENV=build rollup -c files/rollup.config.mjs",
|
|
11
|
+
"build:step": "yarn populatereadme && yarn build:main",
|
|
12
|
+
"build:web": "cross-env NODE_ENV=build rollup -c files/rollup.web.config.mjs",
|
|
13
|
+
"d": "yarn out && yarn lint && run d",
|
|
14
|
+
"docs": "npx docsify-cli init ./docs && yarn fix-docsify",
|
|
15
|
+
"fix-docsify": "cd ../rambda-scripts && yarn fix-docsify:rambda",
|
|
16
|
+
"git:add": "git add -A",
|
|
17
|
+
"github": "cd ../rambda-scripts && yarn github",
|
|
18
|
+
"immutable": "cd ../rambda-scripts && yarn immutable:rambda",
|
|
19
|
+
"immutable:x": "cd ../rambda-scripts && yarn immutable:rambdax",
|
|
20
|
+
"lint": "yarn git:add && yarn lint:staged && yarn git:add",
|
|
21
|
+
"lint:all": "cd ../rambda-scripts && yarn lint",
|
|
22
|
+
"lint:staged": "cd ../rambda-scripts && yarn lint:staged",
|
|
23
|
+
"new": "cd ../rambda-scripts && yarn new",
|
|
24
|
+
"out": "yarn populatedocs && yarn populatereadme && yarn immutable && yarn build",
|
|
25
|
+
"before": "yarn out && yarn docs",
|
|
26
|
+
"populatedocs": "cd ../rambda-scripts && yarn populate:docs",
|
|
27
|
+
"populatedocs:x": "cd ../rambda-scripts && yarn populate:docs:rambdax",
|
|
28
|
+
"populatereadme": "cd ../rambda-scripts && yarn populate:readme",
|
|
29
|
+
"populatereadme:x": "cd ../rambda-scripts && yarn populate:readme:rambdax",
|
|
30
|
+
"run:ramda:test": "cd ../rambda-scripts && yarn run:ramda:test",
|
|
31
|
+
"test": "jest -o -u --watch",
|
|
32
|
+
"test:all": "jest source/*.spec.js -u --bail=false",
|
|
33
|
+
"test:ci": "jest source/*.spec.js --coverage --no-cache -w 1",
|
|
34
|
+
"test:typings": "dtslint --localTs ./node_modules/typescript/lib --expectOnly ./source",
|
|
35
|
+
"usedby": "cd ../rambda-scripts && yarn usedby",
|
|
36
|
+
"x": "yarn populatedocs:x && yarn populatereadme:x && yarn immutable:x"
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@babel/core": "7.21.8",
|
|
41
|
+
"@babel/plugin-proposal-object-rest-spread": "7.20.7",
|
|
42
|
+
"@babel/preset-env": "7.21.5",
|
|
43
|
+
"@definitelytyped/dtslint": "0.0.176",
|
|
44
|
+
"@rollup/plugin-babel": "6.0.3",
|
|
45
|
+
"@rollup/plugin-commonjs": "25.0.0",
|
|
46
|
+
"@rollup/plugin-node-resolve": "15.0.2",
|
|
47
|
+
"@rollup/plugin-replace": "5.0.2",
|
|
48
|
+
"@types/jest": "29.5.1",
|
|
49
|
+
"combinate": "1.1.11",
|
|
50
|
+
"cross-env": "7.0.3",
|
|
51
|
+
"fast-check": "^3.11.0",
|
|
52
|
+
"helpers-fn": "1.8.1",
|
|
53
|
+
"is-ci": "3.0.1",
|
|
54
|
+
"jest": "29.5.0",
|
|
55
|
+
"jest-extended": "3.2.4",
|
|
56
|
+
"lodash": "4.17.21",
|
|
57
|
+
"rambdax": "9.1.1",
|
|
58
|
+
"ramda": "0.29.0",
|
|
59
|
+
"rollup": "3.22.0",
|
|
60
|
+
"rollup-plugin-cleanup": "3.2.1",
|
|
61
|
+
"rollup-plugin-sourcemaps": "0.6.3",
|
|
62
|
+
"rollup-plugin-uglify": "6.0.4",
|
|
63
|
+
"types-ramda": "0.29.2",
|
|
64
|
+
"typescript": "5.2.2"
|
|
65
|
+
},
|
|
66
|
+
"jest": {
|
|
67
|
+
"testEnvironment": "node",
|
|
68
|
+
"testRegex": ".*\\.(spec|test)\\.js$",
|
|
69
|
+
"setupFilesAfterEnv": [
|
|
70
|
+
"./files/testSetup.js"
|
|
71
|
+
],
|
|
72
|
+
"collectCoverageFrom": [
|
|
73
|
+
"source/*.js",
|
|
74
|
+
"!_internals",
|
|
75
|
+
"!benchmarks"
|
|
76
|
+
]
|
|
77
|
+
},
|
|
78
|
+
"repository": {
|
|
79
|
+
"type": "git",
|
|
80
|
+
"url": "git+https://github.com/selfrefactor/rambda.git"
|
|
81
|
+
},
|
|
82
|
+
"license": "MIT",
|
|
83
|
+
"author": "self_refactor",
|
|
84
|
+
"description": "Lightweight and faster alternative to Ramda with included TS definitions",
|
|
85
|
+
"keywords": [
|
|
86
|
+
"ramda",
|
|
87
|
+
"fp",
|
|
88
|
+
"functional",
|
|
89
|
+
"utility",
|
|
90
|
+
"lodash"
|
|
91
|
+
],
|
|
92
|
+
"homepage": "https://github.com/selfrefactor/rambda#readme",
|
|
93
|
+
"files": [
|
|
94
|
+
"dist",
|
|
95
|
+
"src",
|
|
96
|
+
"README.md",
|
|
97
|
+
"CHANGELOG.md",
|
|
98
|
+
"index.d.ts",
|
|
99
|
+
"immutable.d.ts",
|
|
100
|
+
"rambda.js",
|
|
101
|
+
"immutable.js"
|
|
102
|
+
],
|
|
103
|
+
"sideEffects": false,
|
|
104
|
+
"main": "./dist/rambda.js",
|
|
105
|
+
"umd": "./dist/rambda.umd.js",
|
|
106
|
+
"module": "./rambda.js",
|
|
107
|
+
"types": "./index.d.ts"
|
|
107
108
|
}
|
package/rambda.js
CHANGED
|
@@ -20,13 +20,18 @@ export * from './src/applyTo.js'
|
|
|
20
20
|
export * from './src/ascend.js'
|
|
21
21
|
export * from './src/assoc.js'
|
|
22
22
|
export * from './src/assocPath.js'
|
|
23
|
+
export * from './src/binary.js'
|
|
23
24
|
export * from './src/bind.js'
|
|
24
25
|
export * from './src/both.js'
|
|
26
|
+
export * from './src/call.js'
|
|
25
27
|
export * from './src/chain.js'
|
|
26
28
|
export * from './src/clamp.js'
|
|
27
29
|
export * from './src/clone.js'
|
|
30
|
+
export * from './src/collectBy.js'
|
|
31
|
+
export * from './src/comparator.js'
|
|
28
32
|
export * from './src/complement.js'
|
|
29
33
|
export * from './src/compose.js'
|
|
34
|
+
export * from './src/composeWith.js'
|
|
30
35
|
export * from './src/concat.js'
|
|
31
36
|
export * from './src/cond.js'
|
|
32
37
|
export * from './src/converge.js'
|
|
@@ -40,6 +45,7 @@ export * from './src/descend.js'
|
|
|
40
45
|
export * from './src/difference.js'
|
|
41
46
|
export * from './src/differenceWith.js'
|
|
42
47
|
export * from './src/dissoc.js'
|
|
48
|
+
export * from './src/dissocPath.js'
|
|
43
49
|
export * from './src/divide.js'
|
|
44
50
|
export * from './src/drop.js'
|
|
45
51
|
export * from './src/dropLast.js'
|
|
@@ -142,6 +148,7 @@ export * from './src/props.js'
|
|
|
142
148
|
export * from './src/range.js'
|
|
143
149
|
export * from './src/reduce.js'
|
|
144
150
|
export * from './src/reject.js'
|
|
151
|
+
export * from './src/removeIndex.js'
|
|
145
152
|
export * from './src/repeat.js'
|
|
146
153
|
export * from './src/replace.js'
|
|
147
154
|
export * from './src/reverse.js'
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
export function _arity(n, fn){
|
|
2
|
+
switch (n){
|
|
3
|
+
case 0:
|
|
4
|
+
return function (){
|
|
5
|
+
return fn.apply(this, arguments)
|
|
6
|
+
}
|
|
7
|
+
case 1:
|
|
8
|
+
return function (_1){
|
|
9
|
+
return fn.apply(this, arguments)
|
|
10
|
+
}
|
|
11
|
+
case 2:
|
|
12
|
+
return function (_1, _2){
|
|
13
|
+
return fn.apply(this, arguments)
|
|
14
|
+
}
|
|
15
|
+
case 3:
|
|
16
|
+
return function (
|
|
17
|
+
_1, _2, _3
|
|
18
|
+
){
|
|
19
|
+
return fn.apply(this, arguments)
|
|
20
|
+
}
|
|
21
|
+
case 4:
|
|
22
|
+
return function (
|
|
23
|
+
_1, _2, _3, _4
|
|
24
|
+
){
|
|
25
|
+
return fn.apply(this, arguments)
|
|
26
|
+
}
|
|
27
|
+
case 5:
|
|
28
|
+
return function (
|
|
29
|
+
_1, _2, _3, _4, _5
|
|
30
|
+
){
|
|
31
|
+
return fn.apply(this, arguments)
|
|
32
|
+
}
|
|
33
|
+
case 6:
|
|
34
|
+
return function (
|
|
35
|
+
_1, _2, _3, _4, _5, _6
|
|
36
|
+
){
|
|
37
|
+
return fn.apply(this, arguments)
|
|
38
|
+
}
|
|
39
|
+
case 7:
|
|
40
|
+
return function (
|
|
41
|
+
_1, _2, _3, _4, _5, _6, _7
|
|
42
|
+
){
|
|
43
|
+
return fn.apply(this, arguments)
|
|
44
|
+
}
|
|
45
|
+
case 8:
|
|
46
|
+
return function (
|
|
47
|
+
_1, _2, _3, _4, _5, _6, _7, _8
|
|
48
|
+
){
|
|
49
|
+
return fn.apply(this, arguments)
|
|
50
|
+
}
|
|
51
|
+
case 9:
|
|
52
|
+
return function (
|
|
53
|
+
_1, _2, _3, _4, _5, _6, _7, _8, _9
|
|
54
|
+
){
|
|
55
|
+
return fn.apply(this, arguments)
|
|
56
|
+
}
|
|
57
|
+
default:
|
|
58
|
+
return function (
|
|
59
|
+
_1, _2, _3, _4, _5, _6, _7, _8, _9, _10
|
|
60
|
+
){
|
|
61
|
+
return fn.apply(this, arguments)
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import { isInteger } from './isInteger.js'
|
|
2
|
+
|
|
1
3
|
export function createPath(path, delimiter = '.'){
|
|
2
|
-
return typeof path === 'string' ?
|
|
4
|
+
return typeof path === 'string' ?
|
|
5
|
+
path.split(delimiter).map(x => isInteger(x) ? Number(x) : x) :
|
|
6
|
+
path
|
|
3
7
|
}
|