rambda 7.5.0 → 8.1.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 +27 -0
- package/README.md +391 -263
- package/dist/rambda.js +52 -16
- package/dist/rambda.umd.js +1 -1
- package/immutable.d.ts +67 -30
- package/index.d.ts +67 -30
- package/package.json +36 -45
- package/rambda.js +4 -4
- package/src/differenceWith.js +20 -0
- package/src/isPromise.js +1 -1
- package/src/mergeWith.js +3 -1
- package/src/path.js +11 -6
- package/src/propEq.js +1 -1
- package/src/reduce.js +3 -0
- package/src/reverse.js +3 -4
- package/src/set.js +5 -9
- package/src/startsWith.js +6 -6
- package/src/nop.js +0 -1
package/index.d.ts
CHANGED
|
@@ -1,6 +1,23 @@
|
|
|
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"
|
|
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
|
+
|
|
3
|
+
|
|
4
|
+
type LastArrayElement<ValueType extends readonly unknown[]> =
|
|
5
|
+
ValueType extends readonly [infer ElementType]
|
|
6
|
+
? ElementType
|
|
7
|
+
: ValueType extends readonly [infer _, ...infer Tail]
|
|
8
|
+
? LastArrayElement<Tail>
|
|
9
|
+
: ValueType extends ReadonlyArray<infer ElementType>
|
|
10
|
+
? ElementType
|
|
11
|
+
: never;
|
|
12
|
+
type FirstArrayElement<ValueType extends readonly unknown[]> =
|
|
13
|
+
ValueType extends readonly [infer ElementType]
|
|
14
|
+
? ElementType
|
|
15
|
+
: ValueType extends readonly [...infer Head, infer _]
|
|
16
|
+
? FirstArrayElement<Head>
|
|
17
|
+
: ValueType extends ReadonlyArray<infer ElementType>
|
|
18
|
+
? ElementType
|
|
19
|
+
: never;
|
|
2
20
|
|
|
3
|
-
// used in R.reduce to stop the loop
|
|
4
21
|
export function reduceStopper<T>(input: T) : T
|
|
5
22
|
export type IndexedIterator<T, U> = (x: T, i: number) => U;
|
|
6
23
|
export type Iterator<T, U> = (x: T) => U;
|
|
@@ -39,8 +56,7 @@ type Pred = (...x: any[]) => boolean;
|
|
|
39
56
|
export interface Dictionary<T> {[index: string]: T}
|
|
40
57
|
type Partial<T> = { [P in keyof T]?: T[P]};
|
|
41
58
|
|
|
42
|
-
type Evolvable<E extends Evolver> = {
|
|
43
|
-
};
|
|
59
|
+
type Evolvable<E extends Evolver> = {[P in keyof E]?: Evolved<E[P]>};
|
|
44
60
|
|
|
45
61
|
type Evolver<T extends Evolvable<any> = any> = { [key in keyof Partial<T>]: ((value: T[key]) => T[key]) | (T[key] extends Evolvable<any> ? Evolver<T[key]> : never);
|
|
46
62
|
};
|
|
@@ -79,6 +95,19 @@ interface AssocPartialOne<K extends keyof any> {
|
|
|
79
95
|
type AnyFunction = (...args: any[]) => unknown;
|
|
80
96
|
type AnyConstructor = new (...args: any[]) => unknown;
|
|
81
97
|
|
|
98
|
+
type RegExpReplacerFn =
|
|
99
|
+
| ((m: string, offset: number, s: string, groups?: Record<string, string>) => string)
|
|
100
|
+
| ((m: string, p1: string, offset: number, s: string, groups?: Record<string, string>) => string)
|
|
101
|
+
| ((m: string, p1: string, p2: string, offset: number, s: string, groups?: Record<string, string>) => string)
|
|
102
|
+
| ((m: string, p1: string, p2: string, p3: string, offset: number, s: string, groups?: Record<string, string>) => string)
|
|
103
|
+
| ((m: string, p1: string, p2: string, p3: string, p4: string, offset: number, s: string, groups?: Record<string, string>) => string)
|
|
104
|
+
| ((m: string, p1: string, p2: string, p3: string, p4: string, p5: string, offset: number, s: string, groups?: Record<string, string>) => string)
|
|
105
|
+
| ((m: string, p1: string, p2: string, p3: string, p4: string, p5: string, p6: string, offset: number, s: string, groups?: Record<string, string>) => string)
|
|
106
|
+
| ((m: string, p1: string, p2: string, p3: string, p4: string, p5: string, p6: string, p7: string, offset: number, s: string, groups?: Record<string, string>) => string)
|
|
107
|
+
| ((m: string, p1: string, p2: string, p3: string, p4: string, p5: string, p6: string, p7: string, p8: string, offset: number, s: string, groups?: Record<string, string>) => string)
|
|
108
|
+
| ((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)
|
|
109
|
+
type RegExpReplacer = string | RegExpReplacerFn
|
|
110
|
+
|
|
82
111
|
// RAMBDAX INTERFACES
|
|
83
112
|
// ============================================
|
|
84
113
|
type Func<T> = (input: any) => T;
|
|
@@ -405,6 +434,19 @@ export function defaultTo<T>(defaultValue: T): (input: T | null | undefined) =>
|
|
|
405
434
|
export function difference<T>(a: T[], b: T[]): T[];
|
|
406
435
|
export function difference<T>(a: T[]): (b: T[]) => T[];
|
|
407
436
|
|
|
437
|
+
export function differenceWith<T1, T2>(
|
|
438
|
+
pred: (a: T1, b: T2) => boolean,
|
|
439
|
+
list1: T1[],
|
|
440
|
+
list2: T2[],
|
|
441
|
+
): T1[];
|
|
442
|
+
export function differenceWith<T1, T2>(
|
|
443
|
+
pred: (a: T1, b: T2) => boolean,
|
|
444
|
+
): (list1: T1[], list2: T2[]) => T1[];
|
|
445
|
+
export function differenceWith<T1, T2>(
|
|
446
|
+
pred: (a: T1, b: T2) => boolean,
|
|
447
|
+
list1: T1[],
|
|
448
|
+
): (list2: T2[]) => T1[];
|
|
449
|
+
|
|
408
450
|
/**
|
|
409
451
|
* It returns a new object that does not contain property `prop`.
|
|
410
452
|
*/
|
|
@@ -466,10 +508,10 @@ export function either(firstPredicate: Pred): (secondPredicate: Pred) => Pred;
|
|
|
466
508
|
* When iterable is a string, then it behaves as `String.prototype.endsWith`.
|
|
467
509
|
* When iterable is a list, then it uses R.equals to determine if the target list ends in the same way as the given target.
|
|
468
510
|
*/
|
|
469
|
-
export function endsWith(
|
|
470
|
-
export function endsWith(
|
|
471
|
-
export function endsWith<T>(
|
|
472
|
-
export function endsWith<T>(
|
|
511
|
+
export function endsWith<T extends string>(question: T, str: string): boolean;
|
|
512
|
+
export function endsWith<T extends string>(question: T): (str: string) => boolean;
|
|
513
|
+
export function endsWith<T>(question: T[], list: T[]): boolean;
|
|
514
|
+
export function endsWith<T>(question: T[]): (list: T[]) => boolean;
|
|
473
515
|
|
|
474
516
|
/**
|
|
475
517
|
* It returns `true` if property `prop` in `obj1` is equal to property `prop` in `obj2` according to `R.equals`.
|
|
@@ -593,7 +635,7 @@ export function hasPath<T>(
|
|
|
593
635
|
*/
|
|
594
636
|
export function head(input: string): string;
|
|
595
637
|
export function head(emptyList: []): undefined;
|
|
596
|
-
export function head<T>(
|
|
638
|
+
export function head<T extends readonly unknown[]>(array: T): FirstArrayElement<T>
|
|
597
639
|
|
|
598
640
|
/**
|
|
599
641
|
* It returns `true` if its arguments `a` and `b` are identical.
|
|
@@ -630,8 +672,8 @@ export function inc(x: number): number;
|
|
|
630
672
|
*
|
|
631
673
|
* If `input` is array, then `R.equals` is used to define if `valueToFind` belongs to the list.
|
|
632
674
|
*/
|
|
633
|
-
export function includes(valueToFind:
|
|
634
|
-
export function includes(valueToFind:
|
|
675
|
+
export function includes<T extends string>(valueToFind: T, input: string): boolean;
|
|
676
|
+
export function includes<T extends string>(valueToFind: T): (input: string) => boolean;
|
|
635
677
|
export function includes<T>(valueToFind: T, input: T[]): boolean;
|
|
636
678
|
export function includes<T>(valueToFind: T): (input: T[]) => boolean;
|
|
637
679
|
|
|
@@ -718,9 +760,9 @@ export function keys<T>(x: T): string[];
|
|
|
718
760
|
/**
|
|
719
761
|
* It returns the last element of `input`, as the `input` can be either a string or an array.
|
|
720
762
|
*/
|
|
721
|
-
export function last(
|
|
763
|
+
export function last(input: string): string;
|
|
722
764
|
export function last(emptyList: []): undefined;
|
|
723
|
-
export function last<T extends
|
|
765
|
+
export function last<T extends readonly unknown[]>(array: T): LastArrayElement<T>
|
|
724
766
|
|
|
725
767
|
/**
|
|
726
768
|
* It returns the last index of `target` in `list` array.
|
|
@@ -923,11 +965,6 @@ export function negate(x: number): number;
|
|
|
923
965
|
export function none<T>(predicate: (x: T) => boolean, list: T[]): boolean;
|
|
924
966
|
export function none<T>(predicate: (x: T) => boolean): (list: T[]) => boolean;
|
|
925
967
|
|
|
926
|
-
/**
|
|
927
|
-
* It returns `undefined`.
|
|
928
|
-
*/
|
|
929
|
-
export function nop(): void;
|
|
930
|
-
|
|
931
968
|
/**
|
|
932
969
|
* It returns a boolean negated version of `input`.
|
|
933
970
|
*/
|
|
@@ -1222,11 +1259,11 @@ export function prop<P extends keyof never, T>(propToFind: P): {
|
|
|
1222
1259
|
/**
|
|
1223
1260
|
* It returns true if `obj` has property `propToFind` and its value is equal to `valueToMatch`.
|
|
1224
1261
|
*/
|
|
1225
|
-
export function propEq<K extends string | number>(
|
|
1226
|
-
export function propEq<K extends string | number>(
|
|
1227
|
-
export function propEq
|
|
1228
|
-
(
|
|
1229
|
-
(
|
|
1262
|
+
export function propEq<K extends string | number>(valueToMatch: any, propToFind: K, obj: Record<K, any>): boolean;
|
|
1263
|
+
export function propEq<K extends string | number>(valueToMatch: any, propToFind: K): (obj: Record<K, any>) => boolean;
|
|
1264
|
+
export function propEq(valueToMatch: any): {
|
|
1265
|
+
<K extends string | number>(propToFind: K, obj: Record<K, any>): boolean;
|
|
1266
|
+
<K extends string | number>(propToFind: K): (obj: Record<K, any>) => boolean;
|
|
1230
1267
|
};
|
|
1231
1268
|
|
|
1232
1269
|
/**
|
|
@@ -1289,9 +1326,9 @@ export function repeat<T>(x: T, timesToRepeat: number): T[];
|
|
|
1289
1326
|
/**
|
|
1290
1327
|
* It replaces `strOrRegex` found in `str` with `replacer`.
|
|
1291
1328
|
*/
|
|
1292
|
-
export function replace(strOrRegex: RegExp | string, replacer:
|
|
1293
|
-
export function replace(strOrRegex: RegExp | string, replacer:
|
|
1294
|
-
export function replace(strOrRegex: RegExp | string): (replacer:
|
|
1329
|
+
export function replace(strOrRegex: RegExp | string, replacer: RegExpReplacer, str: string): string;
|
|
1330
|
+
export function replace(strOrRegex: RegExp | string, replacer: RegExpReplacer): (str: string) => string;
|
|
1331
|
+
export function replace(strOrRegex: RegExp | string): (replacer: RegExpReplacer) => (str: string) => string;
|
|
1295
1332
|
|
|
1296
1333
|
/**
|
|
1297
1334
|
* It returns a reversed copy of list or string `input`.
|
|
@@ -1368,10 +1405,10 @@ export function splitWhen<T>(predicate: Predicate<T>): <U>(list: U[]) => (U[])[]
|
|
|
1368
1405
|
* When iterable is a string, then it behaves as `String.prototype.startsWith`.
|
|
1369
1406
|
* When iterable is a list, then it uses R.equals to determine if the target list starts in the same way as the given target.
|
|
1370
1407
|
*/
|
|
1371
|
-
export function startsWith(
|
|
1372
|
-
export function startsWith(
|
|
1373
|
-
export function startsWith<T>(
|
|
1374
|
-
export function startsWith<T>(
|
|
1408
|
+
export function startsWith<T extends string>(question: T, input: string): boolean;
|
|
1409
|
+
export function startsWith<T extends string>(question: T): (input: string) => boolean;
|
|
1410
|
+
export function startsWith<T>(question: T[], input: T[]): boolean;
|
|
1411
|
+
export function startsWith<T>(question: T[]): (input: T[]) => boolean;
|
|
1375
1412
|
|
|
1376
1413
|
/**
|
|
1377
1414
|
* Curried version of `x - y`
|
package/package.json
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rambda",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.1.0",
|
|
4
4
|
"scripts": {
|
|
5
|
-
"
|
|
5
|
+
"publish:experimental": "node files/publish",
|
|
6
6
|
"populatedocs": "cd ../rambda-scripts && yarn populate:docs",
|
|
7
7
|
"populatedocs:x": "cd ../rambda-scripts && yarn populate:docs:rambdax",
|
|
8
8
|
"populatereadme": "cd ../rambda-scripts && yarn populate:readme",
|
|
9
9
|
"populatereadme:x": "cd ../rambda-scripts && yarn populate:readme:rambdax",
|
|
10
10
|
"out": "yarn populatedocs && yarn populatereadme && yarn immutable && yarn build",
|
|
11
|
-
"pull": "cd ../rambda-scripts && git pull",
|
|
12
|
-
"outx": "yarn pull && yarn out",
|
|
13
11
|
"x": "yarn populatedocs:x && yarn populatereadme:x && yarn immutable:x",
|
|
14
12
|
"github": "cd ../rambda-scripts && yarn github",
|
|
15
13
|
"fix-docsify": "cd ../rambda-scripts && yarn fix-docsify:rambda",
|
|
@@ -26,48 +24,43 @@
|
|
|
26
24
|
"docs": "npx docsify-cli init ./docs && yarn fix-docsify",
|
|
27
25
|
"new": "cd ../rambda-scripts && yarn new",
|
|
28
26
|
"run:ramda:test": "cd ../rambda-scripts && yarn run:ramda:test",
|
|
29
|
-
"consume-typings:clone": "cd .. && git clone --depth 1 https://github.com/selfrefactor/rambda-scripts.git rambda-scripts-clone",
|
|
30
|
-
"consume-typings:execute": "cd ../rambda-scripts-clone/scripts/consume-typings && yarn start",
|
|
31
|
-
"consume-typings": "yarn consume-typings:clone && yarn consume-typings:execute",
|
|
32
|
-
"test:consume-typings": "jest source/_consumeTypings.test.js",
|
|
33
27
|
"test:typings": "dtslint --localTs ./node_modules/typescript/lib --expectOnly ./source",
|
|
34
28
|
"test:all": "jest source/*.spec.js -u --bail=false",
|
|
35
29
|
"test": "jest -o -u --watch",
|
|
36
30
|
"test:ci": "jest source/*.spec.js --coverage --no-cache -w 1",
|
|
37
|
-
"build:step": "yarn
|
|
31
|
+
"build:step": "yarn populatereadme && yarn build:main",
|
|
38
32
|
"benchmark:all": "yarn build:step && cd ../rambda-scripts && yarn benchmark:all",
|
|
39
33
|
"benchmark:check": "yarn build:step && METHOD=compose yarn benchmark:check:apply",
|
|
40
34
|
"benchmark:check:apply": "cd ../rambda-scripts && yarn check-benchmark",
|
|
41
35
|
"benchmark": "cd ../rambda-scripts && RAMBDA_RUN_ALL=ON RAMBDA_RUN_INDEXES=ON yarn benchmark",
|
|
42
|
-
"d
|
|
43
|
-
"d": "yarn out && yarn lint && run d && yarn d:rambda-scripts"
|
|
36
|
+
"d": "yarn out && yarn lint && run d"
|
|
44
37
|
},
|
|
45
38
|
"dependencies": {},
|
|
46
39
|
"devDependencies": {
|
|
47
|
-
"@babel/core": "7.
|
|
48
|
-
"@babel/plugin-proposal-object-rest-spread": "7.20.
|
|
49
|
-
"@babel/preset-env": "7.
|
|
50
|
-
"@rollup/plugin-babel": "6.0.
|
|
51
|
-
"@rollup/plugin-commonjs": "
|
|
52
|
-
"@rollup/plugin-node-resolve": "15.0.
|
|
53
|
-
"@rollup/plugin-replace": "5.0.
|
|
54
|
-
"@types/jest": "29.
|
|
55
|
-
"@types/ramda": "0.28.23",
|
|
40
|
+
"@babel/core": "7.21.8",
|
|
41
|
+
"@babel/plugin-proposal-object-rest-spread": "7.20.7",
|
|
42
|
+
"@babel/preset-env": "7.21.5",
|
|
43
|
+
"@rollup/plugin-babel": "6.0.3",
|
|
44
|
+
"@rollup/plugin-commonjs": "25.0.0",
|
|
45
|
+
"@rollup/plugin-node-resolve": "15.0.2",
|
|
46
|
+
"@rollup/plugin-replace": "5.0.2",
|
|
47
|
+
"@types/jest": "29.5.1",
|
|
56
48
|
"combinate": "1.1.11",
|
|
57
49
|
"cross-env": "7.0.3",
|
|
58
50
|
"dtslint": "4.2.1",
|
|
59
|
-
"helpers-fn": "1.
|
|
51
|
+
"helpers-fn": "1.8.1",
|
|
60
52
|
"is-ci": "3.0.1",
|
|
61
|
-
"jest": "29.
|
|
62
|
-
"jest-extended": "3.
|
|
53
|
+
"jest": "29.5.0",
|
|
54
|
+
"jest-extended": "3.2.4",
|
|
63
55
|
"lodash": "4.17.21",
|
|
64
|
-
"rambdax": "
|
|
65
|
-
"ramda": "0.
|
|
66
|
-
"rollup": "3.
|
|
56
|
+
"rambdax": "9.1.1",
|
|
57
|
+
"ramda": "0.29.0",
|
|
58
|
+
"rollup": "3.22.0",
|
|
67
59
|
"rollup-plugin-cleanup": "3.2.1",
|
|
68
60
|
"rollup-plugin-sourcemaps": "0.6.3",
|
|
69
61
|
"rollup-plugin-uglify": "6.0.4",
|
|
70
|
-
"
|
|
62
|
+
"types-ramda": "0.29.2",
|
|
63
|
+
"typescript": "5.0.4"
|
|
71
64
|
},
|
|
72
65
|
"jest": {
|
|
73
66
|
"testEnvironment": "node",
|
|
@@ -81,18 +74,6 @@
|
|
|
81
74
|
"!benchmarks"
|
|
82
75
|
]
|
|
83
76
|
},
|
|
84
|
-
"files": [
|
|
85
|
-
"dist",
|
|
86
|
-
"src",
|
|
87
|
-
"esm",
|
|
88
|
-
"mjs",
|
|
89
|
-
"README.md",
|
|
90
|
-
"CHANGELOG.md",
|
|
91
|
-
"index.d.ts",
|
|
92
|
-
"immutable.d.ts",
|
|
93
|
-
"rambda.js",
|
|
94
|
-
"immutable.js"
|
|
95
|
-
],
|
|
96
77
|
"repository": {
|
|
97
78
|
"type": "git",
|
|
98
79
|
"url": "git+https://github.com/selfrefactor/rambda.git"
|
|
@@ -100,11 +81,6 @@
|
|
|
100
81
|
"license": "MIT",
|
|
101
82
|
"author": "self_refactor",
|
|
102
83
|
"description": "Lightweight and faster alternative to Ramda with included TS definitions",
|
|
103
|
-
"sideEffects": false,
|
|
104
|
-
"main": "./dist/rambda.js",
|
|
105
|
-
"umd": "./dist/rambda.umd.js",
|
|
106
|
-
"module": "./rambda.js",
|
|
107
|
-
"types": "./index.d.ts",
|
|
108
84
|
"keywords": [
|
|
109
85
|
"ramda",
|
|
110
86
|
"fp",
|
|
@@ -112,5 +88,20 @@
|
|
|
112
88
|
"utility",
|
|
113
89
|
"lodash"
|
|
114
90
|
],
|
|
115
|
-
"homepage": "https://github.com/selfrefactor/rambda#readme"
|
|
91
|
+
"homepage": "https://github.com/selfrefactor/rambda#readme",
|
|
92
|
+
"files": [
|
|
93
|
+
"dist",
|
|
94
|
+
"src",
|
|
95
|
+
"README.md",
|
|
96
|
+
"CHANGELOG.md",
|
|
97
|
+
"index.d.ts",
|
|
98
|
+
"immutable.d.ts",
|
|
99
|
+
"rambda.js",
|
|
100
|
+
"immutable.js"
|
|
101
|
+
],
|
|
102
|
+
"sideEffects": false,
|
|
103
|
+
"main": "./dist/rambda.js",
|
|
104
|
+
"umd": "./dist/rambda.umd.js",
|
|
105
|
+
"module": "./rambda.js",
|
|
106
|
+
"types": "./index.d.ts"
|
|
116
107
|
}
|
package/rambda.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
/// <reference types="./index.d.ts" />
|
|
2
|
+
export * from './src/F.js'
|
|
3
|
+
export * from './src/T.js'
|
|
2
4
|
export * from './src/add.js'
|
|
3
5
|
export * from './src/adjust.js'
|
|
4
6
|
export * from './src/all.js'
|
|
@@ -29,6 +31,7 @@ export * from './src/curryN.js'
|
|
|
29
31
|
export * from './src/dec.js'
|
|
30
32
|
export * from './src/defaultTo.js'
|
|
31
33
|
export * from './src/difference.js'
|
|
34
|
+
export * from './src/differenceWith.js'
|
|
32
35
|
export * from './src/dissoc.js'
|
|
33
36
|
export * from './src/divide.js'
|
|
34
37
|
export * from './src/drop.js'
|
|
@@ -42,7 +45,6 @@ export * from './src/endsWith.js'
|
|
|
42
45
|
export * from './src/eqProps.js'
|
|
43
46
|
export * from './src/equals.js'
|
|
44
47
|
export * from './src/evolve.js'
|
|
45
|
-
export * from './src/F.js'
|
|
46
48
|
export * from './src/filter.js'
|
|
47
49
|
export * from './src/find.js'
|
|
48
50
|
export * from './src/findIndex.js'
|
|
@@ -102,7 +104,6 @@ export * from './src/move.js'
|
|
|
102
104
|
export * from './src/multiply.js'
|
|
103
105
|
export * from './src/negate.js'
|
|
104
106
|
export * from './src/none.js'
|
|
105
|
-
export * from './src/nop.js'
|
|
106
107
|
export * from './src/not.js'
|
|
107
108
|
export * from './src/nth.js'
|
|
108
109
|
export * from './src/objOf.js'
|
|
@@ -129,8 +130,8 @@ export * from './src/prop.js'
|
|
|
129
130
|
export * from './src/propEq.js'
|
|
130
131
|
export * from './src/propIs.js'
|
|
131
132
|
export * from './src/propOr.js'
|
|
132
|
-
export * from './src/props.js'
|
|
133
133
|
export * from './src/propSatisfies.js'
|
|
134
|
+
export * from './src/props.js'
|
|
134
135
|
export * from './src/range.js'
|
|
135
136
|
export * from './src/reduce.js'
|
|
136
137
|
export * from './src/reject.js'
|
|
@@ -149,7 +150,6 @@ export * from './src/startsWith.js'
|
|
|
149
150
|
export * from './src/subtract.js'
|
|
150
151
|
export * from './src/sum.js'
|
|
151
152
|
export * from './src/symmetricDifference.js'
|
|
152
|
-
export * from './src/T.js'
|
|
153
153
|
export * from './src/tail.js'
|
|
154
154
|
export * from './src/take.js'
|
|
155
155
|
export * from './src/takeLast.js'
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { curry } from './curry.js'
|
|
2
|
+
import { _indexOf } from './equals.js'
|
|
3
|
+
|
|
4
|
+
export function differenceWithFn(
|
|
5
|
+
fn, a, b
|
|
6
|
+
){
|
|
7
|
+
const willReturn = []
|
|
8
|
+
const [ first, second ] = a.length > b.length ? [ a, b ] : [ b, a ]
|
|
9
|
+
|
|
10
|
+
first.forEach(item => {
|
|
11
|
+
const hasItem = second.some(secondItem => fn(item, secondItem))
|
|
12
|
+
if (!hasItem && _indexOf(item, willReturn) === -1){
|
|
13
|
+
willReturn.push(item)
|
|
14
|
+
}
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
return willReturn
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const differenceWith = curry(differenceWithFn)
|
package/src/isPromise.js
CHANGED
package/src/mergeWith.js
CHANGED
package/src/path.js
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import { createPath } from './_internals/createPath.js'
|
|
2
2
|
|
|
3
|
-
export function
|
|
4
|
-
if (arguments.length === 1) return _obj => path(pathInput, _obj)
|
|
5
|
-
|
|
6
|
-
if (obj === null || obj === undefined){
|
|
7
|
-
return undefined
|
|
8
|
-
}
|
|
3
|
+
export function pathFn(pathInput, obj){
|
|
9
4
|
let willReturn = obj
|
|
10
5
|
let counter = 0
|
|
11
6
|
|
|
@@ -23,3 +18,13 @@ export function path(pathInput, obj){
|
|
|
23
18
|
|
|
24
19
|
return willReturn
|
|
25
20
|
}
|
|
21
|
+
|
|
22
|
+
export function path(pathInput, obj){
|
|
23
|
+
if (arguments.length === 1) return _obj => path(pathInput, _obj)
|
|
24
|
+
|
|
25
|
+
if (obj === null || obj === undefined){
|
|
26
|
+
return undefined
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return pathFn(pathInput, obj)
|
|
30
|
+
}
|
package/src/propEq.js
CHANGED
package/src/reduce.js
CHANGED
package/src/reverse.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
export function reverse(listOrString){
|
|
2
|
-
if (typeof listOrString === 'string'){
|
|
3
|
-
return listOrString.split('').reverse()
|
|
4
|
-
.join('')
|
|
1
|
+
export function reverse(listOrString) {
|
|
2
|
+
if (typeof listOrString === 'string') {
|
|
3
|
+
return listOrString.split('').reverse().join('')
|
|
5
4
|
}
|
|
6
5
|
|
|
7
6
|
const clone = listOrString.slice()
|
package/src/set.js
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import {always} from './always.js'
|
|
2
|
+
import {curry} from './curry.js'
|
|
3
|
+
import {over} from './over.js'
|
|
4
4
|
|
|
5
|
-
function setFn(
|
|
6
|
-
lens, replacer, x
|
|
7
|
-
){
|
|
8
|
-
return over(
|
|
9
|
-
lens, always(replacer), x
|
|
10
|
-
)
|
|
5
|
+
function setFn(lens, replacer, x) {
|
|
6
|
+
return over(lens, always(replacer), x)
|
|
11
7
|
}
|
|
12
8
|
|
|
13
9
|
export const set = curry(setFn)
|
package/src/startsWith.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { isArray } from './_internals/isArray.js'
|
|
2
2
|
import { equals } from './equals.js'
|
|
3
3
|
|
|
4
|
-
export function startsWith(
|
|
4
|
+
export function startsWith(question, iterable){
|
|
5
5
|
if (arguments.length === 1)
|
|
6
|
-
return _iterable => startsWith(
|
|
6
|
+
return _iterable => startsWith(question, _iterable)
|
|
7
7
|
|
|
8
8
|
if (typeof iterable === 'string'){
|
|
9
|
-
return iterable.startsWith(
|
|
9
|
+
return iterable.startsWith(question)
|
|
10
10
|
}
|
|
11
|
-
if (!isArray(
|
|
11
|
+
if (!isArray(question)) return false
|
|
12
12
|
|
|
13
13
|
let correct = true
|
|
14
|
-
const filtered =
|
|
14
|
+
const filtered = question.filter((x, index) => {
|
|
15
15
|
if (!correct) return false
|
|
16
16
|
const result = equals(x, iterable[ index ])
|
|
17
17
|
if (!result) correct = false
|
|
@@ -19,5 +19,5 @@ export function startsWith(target, iterable){
|
|
|
19
19
|
return result
|
|
20
20
|
})
|
|
21
21
|
|
|
22
|
-
return filtered.length ===
|
|
22
|
+
return filtered.length === question.length
|
|
23
23
|
}
|
package/src/nop.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export function nop(){}
|