@vinicunca/perkakas 0.3.6 → 0.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/dist/commonjs/array/index.js +0 -4
- package/dist/commonjs/guard/has-sub-object.js +19 -0
- package/dist/commonjs/guard/index.js +3 -0
- package/dist/commonjs/guard/is-deep-equal.js +55 -0
- package/dist/commonjs/guard/is-included-in.js +11 -0
- package/dist/commonjs/object/from-keys.js +15 -0
- package/dist/commonjs/object/index.js +1 -1
- package/dist/commonjs/object/merge.js +2 -2
- package/dist/commonjs/object/omit-by.js +3 -2
- package/dist/commonjs/object/pick-by.js +3 -2
- package/dist/es/array/index.js +0 -4
- package/dist/es/guard/has-sub-object.js +15 -0
- package/dist/es/guard/index.js +3 -0
- package/dist/es/guard/is-deep-equal.js +51 -0
- package/dist/es/guard/is-included-in.js +7 -0
- package/dist/es/object/from-keys.js +11 -0
- package/dist/es/object/index.js +1 -1
- package/dist/es/object/merge.js +2 -2
- package/dist/es/object/omit-by.js +3 -2
- package/dist/es/object/pick-by.js +3 -2
- package/dist/metadata.json +6976 -6506
- package/dist/types/array/difference-with.d.ts +3 -3
- package/dist/types/array/drop-first-by.d.ts +0 -1
- package/dist/types/array/drop-first-by.d.ts.map +1 -1
- package/dist/types/array/drop-last.d.ts +2 -1
- package/dist/types/array/drop-last.d.ts.map +1 -1
- package/dist/types/array/drop.d.ts +2 -1
- package/dist/types/array/drop.d.ts.map +1 -1
- package/dist/types/array/filter.d.ts +14 -0
- package/dist/types/array/filter.d.ts.map +1 -1
- package/dist/types/array/find-index.d.ts +2 -0
- package/dist/types/array/find-index.d.ts.map +1 -1
- package/dist/types/array/find-last-index.d.ts +2 -0
- package/dist/types/array/find-last-index.d.ts.map +1 -1
- package/dist/types/array/first-by.d.ts +0 -1
- package/dist/types/array/first-by.d.ts.map +1 -1
- package/dist/types/array/flat-map.d.ts +2 -0
- package/dist/types/array/flat-map.d.ts.map +1 -1
- package/dist/types/array/flatten-deep.d.ts +5 -4
- package/dist/types/array/flatten-deep.d.ts.map +1 -1
- package/dist/types/array/flatten.d.ts +7 -6
- package/dist/types/array/flatten.d.ts.map +1 -1
- package/dist/types/array/group-by.d.ts +1 -0
- package/dist/types/array/group-by.d.ts.map +1 -1
- package/dist/types/array/has-at-least.d.ts +0 -1
- package/dist/types/array/has-at-least.d.ts.map +1 -1
- package/dist/types/array/index-by.d.ts +0 -1
- package/dist/types/array/index-by.d.ts.map +1 -1
- package/dist/types/array/index.d.ts +0 -4
- package/dist/types/array/index.d.ts.map +1 -1
- package/dist/types/array/last.d.ts +2 -1
- package/dist/types/array/last.d.ts.map +1 -1
- package/dist/types/array/length.d.ts +1 -0
- package/dist/types/array/length.d.ts.map +1 -1
- package/dist/types/array/nth-by.d.ts +0 -1
- package/dist/types/array/nth-by.d.ts.map +1 -1
- package/dist/types/array/only.d.ts +2 -1
- package/dist/types/array/only.d.ts.map +1 -1
- package/dist/types/array/rank-by.d.ts +0 -1
- package/dist/types/array/rank-by.d.ts.map +1 -1
- package/dist/types/array/reduce.d.ts +2 -0
- package/dist/types/array/reduce.d.ts.map +1 -1
- package/dist/types/array/reverse.d.ts +4 -2
- package/dist/types/array/reverse.d.ts.map +1 -1
- package/dist/types/array/sort-by.d.ts +2 -3
- package/dist/types/array/sort-by.d.ts.map +1 -1
- package/dist/types/array/sorted-index-by.d.ts +0 -1
- package/dist/types/array/sorted-index-by.d.ts.map +1 -1
- package/dist/types/array/sorted-index-with.d.ts +0 -1
- package/dist/types/array/sorted-index-with.d.ts.map +1 -1
- package/dist/types/array/sorted-index.d.ts +0 -1
- package/dist/types/array/sorted-index.d.ts.map +1 -1
- package/dist/types/array/sorted-last-index-by.d.ts +0 -1
- package/dist/types/array/sorted-last-index-by.d.ts.map +1 -1
- package/dist/types/array/sorted-last-index.d.ts +0 -1
- package/dist/types/array/sorted-last-index.d.ts.map +1 -1
- package/dist/types/array/splice.d.ts +2 -1
- package/dist/types/array/splice.d.ts.map +1 -1
- package/dist/types/array/split-at.d.ts +2 -0
- package/dist/types/array/split-at.d.ts.map +1 -1
- package/dist/types/array/take-first-by.d.ts +0 -1
- package/dist/types/array/take-first-by.d.ts.map +1 -1
- package/dist/types/array/uniq-with.d.ts +3 -3
- package/dist/types/function/conditional.d.ts +0 -1
- package/dist/types/function/conditional.d.ts.map +1 -1
- package/dist/types/function/purry.d.ts +1 -0
- package/dist/types/function/purry.d.ts.map +1 -1
- package/dist/types/function/times.d.ts +0 -1
- package/dist/types/function/times.d.ts.map +1 -1
- package/dist/types/guard/has-sub-object.d.ts +35 -0
- package/dist/types/guard/has-sub-object.d.ts.map +1 -0
- package/dist/types/guard/index.d.ts +3 -0
- package/dist/types/guard/index.d.ts.map +1 -1
- package/dist/types/guard/is-deep-equal.d.ts +50 -0
- package/dist/types/guard/is-deep-equal.d.ts.map +1 -0
- package/dist/types/guard/is-included-in.d.ts +54 -0
- package/dist/types/guard/is-included-in.d.ts.map +1 -0
- package/dist/types/number/add.d.ts +0 -1
- package/dist/types/number/add.d.ts.map +1 -1
- package/dist/types/number/ceil.d.ts +2 -1
- package/dist/types/number/ceil.d.ts.map +1 -1
- package/dist/types/number/clamp.d.ts +6 -6
- package/dist/types/number/divide.d.ts +0 -1
- package/dist/types/number/divide.d.ts.map +1 -1
- package/dist/types/number/floor.d.ts +2 -1
- package/dist/types/number/floor.d.ts.map +1 -1
- package/dist/types/number/multiply.d.ts +2 -1
- package/dist/types/number/multiply.d.ts.map +1 -1
- package/dist/types/number/round.d.ts +2 -1
- package/dist/types/number/round.d.ts.map +1 -1
- package/dist/types/number/subtract.d.ts +2 -1
- package/dist/types/number/subtract.d.ts.map +1 -1
- package/dist/types/object/from-keys.d.ts +42 -0
- package/dist/types/object/from-keys.d.ts.map +1 -0
- package/dist/types/object/from-pairs.d.ts +1 -1
- package/dist/types/object/index.d.ts +1 -1
- package/dist/types/object/index.d.ts.map +1 -1
- package/dist/types/object/invert.d.ts +2 -0
- package/dist/types/object/invert.d.ts.map +1 -1
- package/dist/types/object/keys.d.ts +1 -0
- package/dist/types/object/keys.d.ts.map +1 -1
- package/dist/types/object/merge.d.ts +39 -12
- package/dist/types/object/merge.d.ts.map +1 -1
- package/dist/types/object/path-or.d.ts +2 -0
- package/dist/types/object/path-or.d.ts.map +1 -1
- package/dist/types/object/pick-by.d.ts +2 -0
- package/dist/types/object/pick-by.d.ts.map +1 -1
- package/dist/types/object/set-path.d.ts +2 -0
- package/dist/types/object/set-path.d.ts.map +1 -1
- package/dist/types/object/values.d.ts +1 -0
- package/dist/types/object/values.d.ts.map +1 -1
- package/dist/types/string/cases-types.d.ts +13 -13
- package/dist/types/string/cases-types.d.ts.map +1 -1
- package/dist/types/string/cases.d.ts +9 -9
- package/dist/types/string/cases.d.ts.map +1 -1
- package/dist/types/string/random-string.d.ts +1 -0
- package/dist/types/string/random-string.d.ts.map +1 -1
- package/dist/types/utils/purry-order-rules.d.ts +4 -4
- package/dist/types/utils/purry-order-rules.d.ts.map +1 -1
- package/package.json +11 -10
- package/dist/commonjs/array/compact.js +0 -8
- package/dist/commonjs/array/count-by.js +0 -24
- package/dist/commonjs/array/difference.js +0 -22
- package/dist/commonjs/array/intersection.js +0 -22
- package/dist/commonjs/object/equals.js +0 -67
- package/dist/es/array/compact.js +0 -4
- package/dist/es/array/count-by.js +0 -20
- package/dist/es/array/difference.js +0 -18
- package/dist/es/array/intersection.js +0 -18
- package/dist/es/object/equals.js +0 -63
- package/dist/types/array/compact.d.ts +0 -12
- package/dist/types/array/compact.d.ts.map +0 -1
- package/dist/types/array/count-by.d.ts +0 -20
- package/dist/types/array/count-by.d.ts.map +0 -1
- package/dist/types/array/difference.d.ts +0 -35
- package/dist/types/array/difference.d.ts.map +0 -1
- package/dist/types/array/intersection.d.ts +0 -30
- package/dist/types/array/intersection.d.ts.map +0 -1
- package/dist/types/object/equals.d.ts +0 -30
- package/dist/types/object/equals.d.ts.map +0 -1
|
@@ -12,7 +12,7 @@ type IsEquals<TFirst, TSecond> = (a: TFirst, b: TSecond) => boolean;
|
|
|
12
12
|
* P.differenceWith(
|
|
13
13
|
* [{a: 1}, {a: 2}, {a: 3}, {a: 4}],
|
|
14
14
|
* [{a: 2}, {a: 5}, {a: 3}],
|
|
15
|
-
* P.
|
|
15
|
+
* P.isDeepEqual,
|
|
16
16
|
* ) // => [{a: 1}, {a: 4}]
|
|
17
17
|
* @dataFirst
|
|
18
18
|
* @category Array
|
|
@@ -29,11 +29,11 @@ export declare function differenceWith<TFirst, TSecond>(array: ReadonlyArray<TFi
|
|
|
29
29
|
* @example
|
|
30
30
|
* P.differenceWith(
|
|
31
31
|
* [{a: 2}, {a: 5}, {a: 3}],
|
|
32
|
-
* P.
|
|
32
|
+
* P.isDeepEqual,
|
|
33
33
|
* )([{a: 1}, {a: 2}, {a: 3}, {a: 4}]) // => [{a: 1}, {a: 4}]
|
|
34
34
|
* P.pipe(
|
|
35
35
|
* [{a: 1}, {a: 2}, {a: 3}, {a: 4}, {a: 5}, {a: 6}], // only 4 iterations
|
|
36
|
-
* P.differenceWith([{a: 2}, {a: 3}], P.
|
|
36
|
+
* P.differenceWith([{a: 2}, {a: 3}], P.isDeepEqual),
|
|
37
37
|
* P.take(2),
|
|
38
38
|
* ) // => [{a: 1}, {a: 4}]
|
|
39
39
|
* @dataLast
|
|
@@ -24,7 +24,6 @@ export declare function dropFirstBy<T>(data: ReadonlyArray<T>, n: number, ...rul
|
|
|
24
24
|
*
|
|
25
25
|
* For the opposite operation (to keep `n` elements) see `takeFirstBy`.
|
|
26
26
|
*
|
|
27
|
-
* @params data - the input array
|
|
28
27
|
* @params n - the number of items to drop. If `n` is non-positive no items would be dropped and a *clone* of the input would be returned, if `n` is bigger then data.length no items would be returned.
|
|
29
28
|
* @param rules - A variadic array of order rules defining the sorting criteria. Each order rule is a projection function that extracts a comparable value from the data. Sorting is based on these extracted values using the native `<` and `>` operators. Earlier rules take precedence over later ones. Use the syntax `[projection, "desc"]` for descending order.
|
|
30
29
|
* @returns a subset of the input array.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drop-first-by.d.ts","sourceRoot":"","sources":["../../../src/array/drop-first-by.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAmB,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAGrE,OAAO,EAAE,KAAK,SAAS,EAA+B,MAAM,4BAA4B,CAAC;AAEzF;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAC3B,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,EACtB,CAAC,EAAE,MAAM,EACT,GAAG,KAAK,EAAE,QAAQ,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,GAC9C,KAAK,CAAC,CAAC,CAAC,CAAC;AAEZ
|
|
1
|
+
{"version":3,"file":"drop-first-by.d.ts","sourceRoot":"","sources":["../../../src/array/drop-first-by.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAmB,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAGrE,OAAO,EAAE,KAAK,SAAS,EAA+B,MAAM,4BAA4B,CAAC;AAEzF;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAC3B,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,EACtB,CAAC,EAAE,MAAM,EACT,GAAG,KAAK,EAAE,QAAQ,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,GAC9C,KAAK,CAAC,CAAC,CAAC,CAAC;AAEZ;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAC3B,CAAC,EAAE,MAAM,EACT,GAAG,KAAK,EAAE,QAAQ,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,GAC9C,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Removes last `n` elements from the `array`.
|
|
3
|
+
*
|
|
3
4
|
* @param array the target array
|
|
4
5
|
* @param n the number of elements to skip
|
|
5
6
|
* @signature
|
|
@@ -12,7 +13,7 @@
|
|
|
12
13
|
export declare function dropLast<T>(array: ReadonlyArray<T>, n: number): Array<T>;
|
|
13
14
|
/**
|
|
14
15
|
* Removes last `n` elements from the `array`.
|
|
15
|
-
*
|
|
16
|
+
*
|
|
16
17
|
* @param n the number of elements to skip
|
|
17
18
|
* @signature
|
|
18
19
|
* P.dropLast(n)(array)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drop-last.d.ts","sourceRoot":"","sources":["../../../src/array/drop-last.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"drop-last.d.ts","sourceRoot":"","sources":["../../../src/array/drop-last.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;AAE1E;;;;;;;;;;GAUG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { LazyEvaluator } from '../function/pipe';
|
|
2
2
|
/**
|
|
3
3
|
* Removes first `n` elements from the `array`.
|
|
4
|
+
*
|
|
4
5
|
* @param array the target array
|
|
5
6
|
* @param n the number of elements to skip
|
|
6
7
|
* @signature
|
|
@@ -14,7 +15,7 @@ import type { LazyEvaluator } from '../function/pipe';
|
|
|
14
15
|
export declare function drop<T>(array: ReadonlyArray<T>, n: number): Array<T>;
|
|
15
16
|
/**
|
|
16
17
|
* Removes first `n` elements from the `array`.
|
|
17
|
-
*
|
|
18
|
+
*
|
|
18
19
|
* @param n the number of elements to skip
|
|
19
20
|
* @signature
|
|
20
21
|
* P.drop(n)(array)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drop.d.ts","sourceRoot":"","sources":["../../../src/array/drop.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAKtD
|
|
1
|
+
{"version":3,"file":"drop.d.ts","sourceRoot":"","sources":["../../../src/array/drop.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAKtD;;;;;;;;;;;;GAYG;AACH,wBAAgB,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;AAEtE;;;;;;;;;;;GAWG;AACH,wBAAgB,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC;AAU1E,yBAAiB,IAAI,CAAC;IACpB,SAAgB,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,aAAa,CAAC,CAAC,CAAC,CAUnD;CACF"}
|
|
@@ -2,6 +2,7 @@ import type { LazyEvaluator } from '../function/pipe';
|
|
|
2
2
|
import type { Pred, PredIndexed, PredIndexedOptional } from '../utils/types';
|
|
3
3
|
/**
|
|
4
4
|
* Filter the elements of an array that meet the condition specified in a callback function.
|
|
5
|
+
*
|
|
5
6
|
* @param array The array to filter.
|
|
6
7
|
* @param fn the callback function.
|
|
7
8
|
* @signature
|
|
@@ -10,6 +11,10 @@ import type { Pred, PredIndexed, PredIndexedOptional } from '../utils/types';
|
|
|
10
11
|
* @example
|
|
11
12
|
* P.filter([1, 2, 3], x => x % 2 === 1) // => [1, 3]
|
|
12
13
|
* P.filter.indexed([1, 2, 3], (x, i, array) => x % 2 === 1) // => [1, 3]
|
|
14
|
+
* // Excludes the values from `other` array
|
|
15
|
+
* P.filter(array, P.isNot(P.isIncludedIn(other)))
|
|
16
|
+
* // Returns a list of elements that exist in both array.
|
|
17
|
+
* P.filter(array, P.isIncludedIn(other))
|
|
13
18
|
* @dataFirst
|
|
14
19
|
* @indexed
|
|
15
20
|
* @pipeable
|
|
@@ -19,6 +24,7 @@ export declare function filter<T, S extends T>(array: ReadonlyArray<T>, fn: (val
|
|
|
19
24
|
export declare function filter<T>(array: ReadonlyArray<T>, fn: Pred<T, boolean>): Array<T>;
|
|
20
25
|
/**
|
|
21
26
|
* Filter the elements of an array that meet the condition specified in a callback function.
|
|
27
|
+
*
|
|
22
28
|
* @param fn the callback function.
|
|
23
29
|
* @signature
|
|
24
30
|
* P.filter(fn)(array)
|
|
@@ -26,6 +32,14 @@ export declare function filter<T>(array: ReadonlyArray<T>, fn: Pred<T, boolean>)
|
|
|
26
32
|
* @example
|
|
27
33
|
* P.pipe([1, 2, 3], P.filter(x => x % 2 === 1)) // => [1, 3]
|
|
28
34
|
* P.pipe([1, 2, 3], P.filter.indexed((x, i) => x % 2 === 1)) // => [1, 3]
|
|
35
|
+
* // Filter out all falsy values
|
|
36
|
+
* P.filter(P.isTruthy)
|
|
37
|
+
* // Counts how many values of the collection pass the specified predicate
|
|
38
|
+
* P.filter(fn).length
|
|
39
|
+
* // Excludes the values from `other` array
|
|
40
|
+
* P.filter(P.isNot(P.isIncludedIn(other)))
|
|
41
|
+
* // Returns a list of elements that exist in both array.
|
|
42
|
+
* P.filter(P.isIncludedIn(other))
|
|
29
43
|
* @dataLast
|
|
30
44
|
* @indexed
|
|
31
45
|
* @pipeable
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter.d.ts","sourceRoot":"","sources":["../../../src/array/filter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA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AC,SAAS,CAAC,EACpC,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,EACvB,EAAE,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,KAAK,KAAK,IAAI,CAAC,GACnE,KAAK,CAAC,CAAC,CAAC,CAAC;IACZ,SAAgB,OAAO,CAAC,CAAC,EACvB,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,EACvB,EAAE,EAAE,WAAW,CAAC,CAAC,EAAE,OAAO,CAAC,GAC1B,KAAK,CAAC,CAAC,CAAC,CAAC;IACZ;;OAEG;IACH,SAAgB,OAAO,CAAC,CAAC,EAAE,CAAC,SAAS,CAAC,EACpC,EAAE,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,KAAK,KAAK,IAAI,CAAC,GACnE,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC;IACzC,SAAgB,OAAO,CAAC,CAAC,EACvB,EAAE,EAAE,WAAW,CAAC,CAAC,EAAE,OAAO,CAAC,GAC1B,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC;IAKlC,MAAM,IAAI,8DAAe,CAAC;IAC1B,MAAM,WAAW;;KAA6B,CAAC;CACvD"}
|
|
@@ -2,6 +2,7 @@ import type { LazyEvaluator } from '../function/pipe';
|
|
|
2
2
|
import type { Pred, PredIndexed, PredIndexedOptional } from '../utils/types';
|
|
3
3
|
/**
|
|
4
4
|
* Returns the index of the first element in the array where predicate is true, and -1 otherwise.
|
|
5
|
+
*
|
|
5
6
|
* @param items the array
|
|
6
7
|
* @param fn the predicate
|
|
7
8
|
* @signature
|
|
@@ -18,6 +19,7 @@ import type { Pred, PredIndexed, PredIndexedOptional } from '../utils/types';
|
|
|
18
19
|
export declare function findIndex<T>(items: ReadonlyArray<T>, fn: Pred<T, boolean>): number;
|
|
19
20
|
/**
|
|
20
21
|
* Returns the index of the first element in the array where predicate is true, and -1 otherwise.
|
|
22
|
+
*
|
|
21
23
|
* @param fn the predicate
|
|
22
24
|
* @signature
|
|
23
25
|
* P.findIndex(fn)(items)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-index.d.ts","sourceRoot":"","sources":["../../../src/array/find-index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAM7E
|
|
1
|
+
{"version":3,"file":"find-index.d.ts","sourceRoot":"","sources":["../../../src/array/find-index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAM7E;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,SAAS,CAAC,CAAC,EACzB,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,EACvB,EAAE,EAAE,IAAI,CAAC,CAAC,EAAE,OAAO,CAAC,GACnB,MAAM,CAAC;AAEV;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,SAAS,CAAC,CAAC,EACzB,EAAE,EAAE,IAAI,CAAC,CAAC,EAAE,OAAO,CAAC,GACnB,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC;AA0BvC,yBAAiB,SAAS,CAAC;IACzB,SAAgB,OAAO,CAAC,CAAC,EACvB,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,EACvB,EAAE,EAAE,WAAW,CAAC,CAAC,EAAE,OAAO,CAAC,GAC1B,MAAM,CAAC;IACV,SAAgB,OAAO,CAAC,CAAC,EACvB,EAAE,EAAE,WAAW,CAAC,CAAC,EAAE,OAAO,CAAC,GAC1B,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC;IAKhC,MAAM,IAAI;;KAAyB,CAAC;IAEpC,MAAM,WAAW;;;;KAAuC,CAAC;CACjE"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Pred, PredIndexed } from '../utils/types';
|
|
2
2
|
/**
|
|
3
3
|
* Returns the index of the last element in the array where predicate is true, and -1 otherwise.
|
|
4
|
+
*
|
|
4
5
|
* @param array the array
|
|
5
6
|
* @param fn the predicate
|
|
6
7
|
* @signature
|
|
@@ -17,6 +18,7 @@ import type { Pred, PredIndexed } from '../utils/types';
|
|
|
17
18
|
export declare function findLastIndex<T>(array: ReadonlyArray<T>, fn: Pred<T, boolean>): number;
|
|
18
19
|
/**
|
|
19
20
|
* Returns the index of the last element in the array where predicate is true, and -1 otherwise.
|
|
21
|
+
*
|
|
20
22
|
* @param fn the predicate
|
|
21
23
|
* @signature
|
|
22
24
|
* P.findLastIndex(fn)(items)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-last-index.d.ts","sourceRoot":"","sources":["../../../src/array/find-last-index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,WAAW,EAAuB,MAAM,gBAAgB,CAAC;AAI7E
|
|
1
|
+
{"version":3,"file":"find-last-index.d.ts","sourceRoot":"","sources":["../../../src/array/find-last-index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,WAAW,EAAuB,MAAM,gBAAgB,CAAC;AAI7E;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAC7B,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,EACvB,EAAE,EAAE,IAAI,CAAC,CAAC,EAAE,OAAO,CAAC,GACnB,MAAM,CAAC;AAEV;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAC7B,EAAE,EAAE,IAAI,CAAC,CAAC,EAAE,OAAO,CAAC,GACnB,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC;AAkBvC,yBAAiB,aAAa,CAAC;IAC7B,SAAgB,OAAO,CAAC,CAAC,EACvB,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,EACvB,EAAE,EAAE,WAAW,CAAC,CAAC,EAAE,OAAO,CAAC,GAC1B,MAAM,CAAC;IACV,SAAgB,OAAO,CAAC,CAAC,EACvB,EAAE,EAAE,WAAW,CAAC,CAAC,EAAE,OAAO,CAAC,GAC1B,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC;CAKxC"}
|
|
@@ -6,7 +6,6 @@ type FirstBy<T extends IterableContainer> = (T extends readonly [unknown, ...Rea
|
|
|
6
6
|
*
|
|
7
7
|
* Use `nthBy` if you need an element other that the first, or `takeFirstBy` if you more than just the first element.
|
|
8
8
|
*
|
|
9
|
-
* @param data an array of items
|
|
10
9
|
* @param rules - A variadic array of order rules defining the sorting criteria. Each order rule is a projection function that extracts a comparable value from the data. Sorting is based on these extracted values using the native `<` and `>` operators. Earlier rules take precedence over later ones. Use the syntax `[projection, "desc"]` for descending ordeP.
|
|
11
10
|
* @returns the first element by the order criteria, or `undefined` if the array
|
|
12
11
|
* is empty. (The function provides strong typing if the input type assures the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"first-by.d.ts","sourceRoot":"","sources":["../../../src/array/first-by.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAmB,iBAAiB,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAExF,OAAO,EAAE,KAAK,SAAS,EAAmB,MAAM,4BAA4B,CAAC;AAG7E,KAAK,OAAO,CAAC,CAAC,SAAS,iBAAiB,IACpC,CAAC,CAAC,SAAS,SAA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+1,7 @@
|
|
|
1
1
|
import type { LazyEvaluator } from '../function/pipe';
|
|
2
2
|
/**
|
|
3
3
|
* Map each element of an array using a defined callback function and flatten the mapped result.
|
|
4
|
+
*
|
|
4
5
|
* @param array The array to map.
|
|
5
6
|
* @param fn The function mapper.
|
|
6
7
|
* @signature
|
|
@@ -14,6 +15,7 @@ import type { LazyEvaluator } from '../function/pipe';
|
|
|
14
15
|
export declare function flatMap<T, K>(array: ReadonlyArray<T>, fn: (input: T) => K | ReadonlyArray<K>): Array<K>;
|
|
15
16
|
/**
|
|
16
17
|
* Map each element of an array using a defined callback function and flatten the mapped result.
|
|
18
|
+
*
|
|
17
19
|
* @param fn The function mapper.
|
|
18
20
|
* @signature
|
|
19
21
|
* P.flatMap(fn)(array)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flat-map.d.ts","sourceRoot":"","sources":["../../../src/array/flat-map.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAKtD
|
|
1
|
+
{"version":3,"file":"flat-map.d.ts","sourceRoot":"","sources":["../../../src/array/flat-map.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAKtD;;;;;;;;;;;;GAYG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,CAAC,EAC1B,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,EACvB,EAAE,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,GACrC,KAAK,CAAC,CAAC,CAAC,CAAC;AAEZ;;;;;;;;;;;GAWG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,CAAC,EAC1B,EAAE,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,GACrC,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC;AAazC,yBAAiB,OAAO,CAAC;IACvB,SAAgB,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,CAQtF;CACF"}
|
|
@@ -5,18 +5,19 @@ type FlattenDeep3<T> = T extends ReadonlyArray<infer K> ? FlattenDeep4<K> : T;
|
|
|
5
5
|
type FlattenDeep4<T> = T extends ReadonlyArray<infer K> ? K : T;
|
|
6
6
|
/**
|
|
7
7
|
* Recursively flattens `array`.
|
|
8
|
+
*
|
|
8
9
|
* @param items the target array
|
|
9
10
|
* @signature
|
|
10
11
|
* P.flattenDeep(array)
|
|
11
12
|
* @example
|
|
12
13
|
* P.flattenDeep([[1, 2], [[3], [4, 5]]]) // => [1, 2, 3, 4, 5]
|
|
13
|
-
* @category Array
|
|
14
14
|
* @pipeable
|
|
15
|
+
* @category Array
|
|
15
16
|
*/
|
|
16
17
|
export declare function flattenDeep<T>(items: ReadonlyArray<T>): Array<FlattenDeep<T>>;
|
|
17
18
|
/**
|
|
18
19
|
* Recursively flattens `array`.
|
|
19
|
-
*
|
|
20
|
+
*
|
|
20
21
|
* @signature
|
|
21
22
|
* P.flattenDeep()(array)
|
|
22
23
|
* @example
|
|
@@ -24,9 +25,9 @@ export declare function flattenDeep<T>(items: ReadonlyArray<T>): Array<FlattenDe
|
|
|
24
25
|
* [[1, 2], [[3], [4, 5]]],
|
|
25
26
|
* P.flattenDeep(),
|
|
26
27
|
* ); // => [1, 2, 3, 4, 5]
|
|
27
|
-
* @category Array
|
|
28
|
-
* @pipeable
|
|
29
28
|
* @dataLast
|
|
29
|
+
* @pipeable
|
|
30
|
+
* @category Array
|
|
30
31
|
*/
|
|
31
32
|
export declare function flattenDeep<T>(): (items: ReadonlyArray<T>) => Array<FlattenDeep<T>>;
|
|
32
33
|
export declare namespace flattenDeep {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flatten-deep.d.ts","sourceRoot":"","sources":["../../../src/array/flatten-deep.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAKtD,KAAK,WAAW,CAAC,CAAC,IAAI,CAAC,SAAS,aAAa,CAAC,MAAM,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AAC7E,KAAK,YAAY,CAAC,CAAC,IAAI,CAAC,SAAS,aAAa,CAAC,MAAM,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AAC9E,KAAK,YAAY,CAAC,CAAC,IAAI,CAAC,SAAS,aAAa,CAAC,MAAM,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AAC9E,KAAK,YAAY,CAAC,CAAC,IAAI,CAAC,SAAS,aAAa,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAEhE
|
|
1
|
+
{"version":3,"file":"flatten-deep.d.ts","sourceRoot":"","sources":["../../../src/array/flatten-deep.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAKtD,KAAK,WAAW,CAAC,CAAC,IAAI,CAAC,SAAS,aAAa,CAAC,MAAM,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AAC7E,KAAK,YAAY,CAAC,CAAC,IAAI,CAAC,SAAS,aAAa,CAAC,MAAM,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AAC9E,KAAK,YAAY,CAAC,CAAC,IAAI,CAAC,SAAS,aAAa,CAAC,MAAM,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AAC9E,KAAK,YAAY,CAAC,CAAC,IAAI,CAAC,SAAS,aAAa,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAEhE;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;AAE/E;;;;;;;;;;;;;GAaG;AACH,wBAAgB,WAAW,CAAC,CAAC,KAAK,CAChC,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,KACpB,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;AA2B3B,yBAAiB,WAAW,CAAC;IAC3B,SAAgB,IAAI,CAAC,CAAC,KAAK,aAAa,CAAC,CAAC,EAAE,GAAG,CAAC,CAO/C;CACF"}
|
|
@@ -2,23 +2,24 @@ import type { LazyEvaluator } from '../function/pipe';
|
|
|
2
2
|
type Flatten<T> = T extends ReadonlyArray<infer K> ? K : T;
|
|
3
3
|
/**
|
|
4
4
|
* Flattens `array` a single level deep.
|
|
5
|
-
*
|
|
5
|
+
*
|
|
6
6
|
* @param items the target array
|
|
7
|
-
* @signature
|
|
7
|
+
* @signature
|
|
8
|
+
* P.flatten(array)
|
|
8
9
|
* @example
|
|
9
10
|
* P.flatten([[1, 2], [3], [4, 5]]) // => [1, 2, 3, 4, 5]
|
|
10
11
|
* P.pipe(
|
|
11
12
|
* [[1, 2], [3], [4, 5]],
|
|
12
13
|
* P.flatten(),
|
|
13
14
|
* ); // => [1, 2, 3, 4, 5]
|
|
14
|
-
* @
|
|
15
|
+
* @dataFirst
|
|
15
16
|
* @pipeable
|
|
17
|
+
* @category Array
|
|
16
18
|
*/
|
|
17
19
|
export declare function flatten<T>(items: ReadonlyArray<T>): Array<Flatten<T>>;
|
|
18
20
|
/**
|
|
19
21
|
* Flattens `array` a single level deep.
|
|
20
22
|
*
|
|
21
|
-
* @param items the target array
|
|
22
23
|
* @signature
|
|
23
24
|
* P.flatten()(array)
|
|
24
25
|
* @example
|
|
@@ -26,9 +27,9 @@ export declare function flatten<T>(items: ReadonlyArray<T>): Array<Flatten<T>>;
|
|
|
26
27
|
* [[1, 2], [3], [4, 5]],
|
|
27
28
|
* P.flatten(),
|
|
28
29
|
* ); // => [1, 2, 3, 4, 5]
|
|
29
|
-
* @category Array
|
|
30
|
-
* @pipeable
|
|
31
30
|
* @dataLast
|
|
31
|
+
* @pipeable
|
|
32
|
+
* @category Array
|
|
32
33
|
*/
|
|
33
34
|
export declare function flatten<T>(): (items: ReadonlyArray<T>) => Array<Flatten<T>>;
|
|
34
35
|
export declare namespace flatten {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flatten.d.ts","sourceRoot":"","sources":["../../../src/array/flatten.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAKtD,KAAK,OAAO,CAAC,CAAC,IAAI,CAAC,SAAS,aAAa,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAE3D
|
|
1
|
+
{"version":3,"file":"flatten.d.ts","sourceRoot":"","sources":["../../../src/array/flatten.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAKtD,KAAK,OAAO,CAAC,CAAC,IAAI,CAAC,SAAS,aAAa,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAE3D;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;AAEvE;;;;;;;;;;;;;GAaG;AACH,wBAAgB,OAAO,CAAC,CAAC,KAAK,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;AAU7E,yBAAiB,OAAO,CAAC;IACvB,SAAgB,IAAI,CAAC,CAAC,KAAK,aAAa,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAMtD;CACF"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { NonEmptyArray, PredIndexed } from '../utils/types';
|
|
2
2
|
/**
|
|
3
3
|
* Splits a collection into sets, grouped by the result of running each value through `fn`.
|
|
4
|
+
*
|
|
4
5
|
* @param items the items to group
|
|
5
6
|
* @param fn the grouping function. When `undefined` is returned the item would
|
|
6
7
|
* be skipped and not grouped under any key.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"group-by.d.ts","sourceRoot":"","sources":["../../../src/array/group-by.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAuB,MAAM,gBAAgB,CAAC;AAItF
|
|
1
|
+
{"version":3,"file":"group-by.d.ts","sourceRoot":"","sources":["../../../src/array/group-by.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAuB,MAAM,gBAAgB,CAAC;AAItF;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,OAAO,CAAC,CAAC,EACvB,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,EACvB,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,WAAW,GAAG,SAAS,GACvC,MAAM,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;AAEzC,wBAAgB,OAAO,CAAC,CAAC,EACvB,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,WAAW,GAAG,SAAS,GACvC,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;AA2CtE,UAAU,MAAM;IAEd,CAAC,KAAK,EAAE,GAAG,SAAS,WAA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AAE,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAEnD,yBAAiB,OAAO,CAAC;IACvB,SAAgB,OAAO,CAAC,CAAC,EACvB,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,EACvB,EAAE,EAAE,WAAW,CAAC,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC,GAC1C,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;IACpC,SAAgB,OAAO,CAAC,CAAC,EACvB,EAAE,EAAE,WAAW,CAAC,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC,GAC1C,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;IAK1D,MAAM,MAAM,EAAE,MAAgB,CAAC;CACvC"}
|
|
@@ -25,7 +25,6 @@ export declare function hasAtLeast<T, N extends number>(data: ReadonlyArray<T>,
|
|
|
25
25
|
* refines the output type accordingly so that those indices are defined when
|
|
26
26
|
* accessing the array even when using typescript's 'noUncheckedIndexAccess'.
|
|
27
27
|
*
|
|
28
|
-
* @param data the input array
|
|
29
28
|
* @param minimum the minimum number of elements the array must have
|
|
30
29
|
* @return true if the array's length is *at least* `minimum`.
|
|
31
30
|
* @signature
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"has-at-least.d.ts","sourceRoot":"","sources":["../../../src/array/has-at-least.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"has-at-least.d.ts","sourceRoot":"","sources":["../../../src/array/has-at-least.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAI/C,KAAK,SAAS,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,IAAI,MAAM,SAAS,CAAC,GAEpD,KAAK,CAAC,CAAC,CAAC,GAGR,CAAC,SAAS,CAAC,GACP,KAAK,CAAC,CAAC,CAAC,GACR,CAAC,GAAG,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AAE5C;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,EAC5C,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,EACtB,OAAO,EAAE,CAAC,GAET,IAAI,IAAI,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAE3B;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,MAAM,EACzC,OAAO,EAAE,CAAC,GAET,CAAC,CAAC,EAAE,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,KAAK,IAAI,IAAI,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC"}
|
|
@@ -22,7 +22,6 @@ export declare function indexBy<T>(array: ReadonlyArray<T>, fn: (item: T) => unk
|
|
|
22
22
|
* (casted to a string). Use the strict version to maintain the given key's type, so
|
|
23
23
|
* long as it is a valid `PropertyKey`.
|
|
24
24
|
*
|
|
25
|
-
* @param array the array
|
|
26
25
|
* @param fn the indexing function
|
|
27
26
|
* @signature
|
|
28
27
|
* P.indexBy(fn)(array)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-by.d.ts","sourceRoot":"","sources":["../../../src/array/index-by.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAuB,MAAM,gBAAgB,CAAC;AAIvE;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,OAAO,CAAC,CAAC,EACvB,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,EACvB,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,OAAO,GACvB,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;AAErB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gB,OAAO,CAAC,CAAC,EACvB,EAAE,EAAE,WAAW,CAAC,CAAC,EAAE,OAAO,CAAC,GAC1B,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IAI3C,MAAM,MAAM,sBAAgB,CAAC;CACrC"}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
export * from './all-pass';
|
|
2
2
|
export * from './any-pass';
|
|
3
3
|
export * from './chunk';
|
|
4
|
-
export * from './compact';
|
|
5
4
|
export * from './concat';
|
|
6
|
-
export * from './count-by';
|
|
7
5
|
export * from './difference-with';
|
|
8
|
-
export * from './difference';
|
|
9
6
|
export * from './drop-last';
|
|
10
7
|
export * from './drop';
|
|
11
8
|
export * from './drop-first-by';
|
|
@@ -26,7 +23,6 @@ export * from './for-each';
|
|
|
26
23
|
export * from './group-by';
|
|
27
24
|
export * from './has-at-least';
|
|
28
25
|
export * from './index-by';
|
|
29
|
-
export * from './intersection';
|
|
30
26
|
export * from './intersection-with';
|
|
31
27
|
export * from './join';
|
|
32
28
|
export * from './last';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/array/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/array/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CA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QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { NonEmptyArray } from '../utils/types';
|
|
2
2
|
/**
|
|
3
3
|
* Gets the last element of `array`.
|
|
4
|
+
*
|
|
4
5
|
* @param array the array
|
|
5
6
|
* @signature
|
|
6
7
|
* P.last(array)
|
|
@@ -15,7 +16,7 @@ export declare function last<T>(array: Readonly<NonEmptyArray<T>>): T;
|
|
|
15
16
|
export declare function last<T>(array: ReadonlyArray<T>): T | undefined;
|
|
16
17
|
/**
|
|
17
18
|
* Gets the last element of `array`.
|
|
18
|
-
*
|
|
19
|
+
*
|
|
19
20
|
* @signature
|
|
20
21
|
* P.last()(array)
|
|
21
22
|
* @example
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"last.d.ts","sourceRoot":"","sources":["../../../src/array/last.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAIpD
|
|
1
|
+
{"version":3,"file":"last.d.ts","sourceRoot":"","sources":["../../../src/array/last.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAIpD;;;;;;;;;;;;GAYG;AACH,wBAAgB,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AAC9D,wBAAgB,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC;AAEhE;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,IAAI,CAAC,CAAC,KAAK,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,SAAS,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"length.d.ts","sourceRoot":"","sources":["../../../src/array/length.ts"],"names":[],"mappings":"AAEA,KAAK,UAAU,CAAC,CAAC,IAAI,SAAS,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;AAEhD
|
|
1
|
+
{"version":3,"file":"length.d.ts","sourceRoot":"","sources":["../../../src/array/length.ts"],"names":[],"mappings":"AAEA,KAAK,UAAU,CAAC,CAAC,IAAI,SAAS,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;AAEhD;;;;;;;;;GASG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC;AACxD,wBAAgB,MAAM,CAAC,CAAC,KAAK,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC"}
|
|
@@ -30,7 +30,6 @@ export declare function nthBy<T extends IterableContainer>(data: T, index: numbe
|
|
|
30
30
|
* but only for `index === 0`.
|
|
31
31
|
* See `takeFirstBy` to get all the elements up to and including `index`.
|
|
32
32
|
*
|
|
33
|
-
* @param data - The input array.
|
|
34
33
|
* @param index - The zero-based index for selecting the element in the sorted order. Negative indices count backwards from the end.
|
|
35
34
|
* @param rules - A variadic array of order rules defining the sorting criteria. Each order rule is a projection function that extracts a comparable value from the data. Sorting is based on these extracted values using the native `<` and `>` operators. Earlier rules take precedence over later ones. Use the syntax `[projection, "desc"]` for descending order.
|
|
36
35
|
* @returns The element at the specified index in the sorted order, or `undefined` if the index is out of bounds.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nth-by.d.ts","sourceRoot":"","sources":["../../../src/array/nth-by.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAmB,iBAAiB,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAExF,OAAO,EAAE,KAAK,SAAS,EAA+B,MAAM,4BAA4B,CAAC;AAGzF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,KAAK,CAAC,CAAC,SAAS,iBAAiB,EAC/C,IAAI,EAAE,CAAC,EACP,KAAK,EAAE,MAAM,EACb,GAAG,KAAK,EAAE,QAAQ,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GACtD,CAAC,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;AAEzB
|
|
1
|
+
{"version":3,"file":"nth-by.d.ts","sourceRoot":"","sources":["../../../src/array/nth-by.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAmB,iBAAiB,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAExF,OAAO,EAAE,KAAK,SAAS,EAA+B,MAAM,4BAA4B,CAAC;AAGzF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,KAAK,CAAC,CAAC,SAAS,iBAAiB,EAC/C,IAAI,EAAE,CAAC,EACP,KAAK,EAAE,MAAM,EACb,GAAG,KAAK,EAAE,QAAQ,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GACtD,CAAC,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;AAEzB;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,KAAK,CAAC,CAAC,SAAS,iBAAiB,EAC/C,KAAK,EAAE,MAAM,EACb,GAAG,KAAK,EAAE,QAAQ,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GACtD,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC"}
|
|
@@ -4,6 +4,7 @@ type Only<T extends IterableContainer> = T extends readonly [...Array<unknown>,
|
|
|
4
4
|
* Returns the first and only element of `array`, or undefined otherwise.
|
|
5
5
|
* Note: In `pipe`, use `only()` form instead of `only`. Otherwise, the
|
|
6
6
|
* inferred type is lost.
|
|
7
|
+
*
|
|
7
8
|
* @param array the target array
|
|
8
9
|
* @signature
|
|
9
10
|
* P.only(array)
|
|
@@ -20,7 +21,7 @@ export declare function only<T extends IterableContainer>(array: Readonly<T>): O
|
|
|
20
21
|
* Returns the first and only element of `array`, or undefined otherwise.
|
|
21
22
|
* Note: In `pipe`, use `only()` form instead of `only`. Otherwise, the
|
|
22
23
|
* inferred type is lost.
|
|
23
|
-
*
|
|
24
|
+
*
|
|
24
25
|
* @signature
|
|
25
26
|
* P.only(array)
|
|
26
27
|
* @example
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"only.d.ts","sourceRoot":"","sources":["../../../src/array/only.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAIzD,KAAK,IAAI,CAAC,CAAC,SAAS,iBAAiB,IAAI,CAAC,SACtC,SAAS,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,GAC9C,SAAS,EAAE,GACX,SAAS,CAAC,OAAO,EAAE,GAAG,KAAK,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,GAC9C,SAAS,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,GAC9C,SAAS,GACT,CAAC,SAAS,SAAS,CAAC,OAAO,CAAC,GAC1B,CAAC,CAAC,MAAM,CAAC,GACT,CAAC,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;AAE5B
|
|
1
|
+
{"version":3,"file":"only.d.ts","sourceRoot":"","sources":["../../../src/array/only.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAIzD,KAAK,IAAI,CAAC,CAAC,SAAS,iBAAiB,IAAI,CAAC,SACtC,SAAS,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,GAC9C,SAAS,EAAE,GACX,SAAS,CAAC,OAAO,EAAE,GAAG,KAAK,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,GAC9C,SAAS,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,GAC9C,SAAS,GACT,CAAC,SAAS,SAAS,CAAC,OAAO,CAAC,GAC1B,CAAC,CAAC,MAAM,CAAC,GACT,CAAC,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;AAE5B;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,iBAAiB,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;AAE/E;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,iBAAiB,KAAK,CACnD,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,KACf,IAAI,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -22,7 +22,6 @@ export declare function rankBy<T>(data: ReadonlyArray<T>, item: T, ...rules: Rea
|
|
|
22
22
|
/**
|
|
23
23
|
* Calculates the rank of an item in an array based on `rules`. The rank is the position where the item would appear in the sorted array. This function provides an efficient way to determine the rank in *O(n)* time, compared to *O(nlogn)* for the equivalent `sortedIndex(sortBy(data, ...rules), item)`.
|
|
24
24
|
*
|
|
25
|
-
* @param data - The input array.
|
|
26
25
|
* @param item - The item whose rank is to be determined.
|
|
27
26
|
* @param rules - A variadic array of order rules defining the sorting criteria. Each order rule is a projection function that extracts a comparable value from the data. Sorting is based on these extracted values using the native `<` and `>` operators. Earlier rules take precedence over later ones. Use the syntax `[projection, "desc"]` for descending order.
|
|
28
27
|
* @returns - The rank of the item in the sorted array in the range [0..data.length]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rank-by.d.ts","sourceRoot":"","sources":["../../../src/array/rank-by.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAmB,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAErE,OAAO,EAAE,KAAK,SAAS,EAA+B,MAAM,4BAA4B,CAAC;AAEzF;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,MAAM,CAAC,CAAC,EACtB,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,EACtB,IAAI,EAAE,CAAC,EACP,GAAG,KAAK,EAAE,QAAQ,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,GAC9C,MAAM,CAAC;AAEV
|
|
1
|
+
{"version":3,"file":"rank-by.d.ts","sourceRoot":"","sources":["../../../src/array/rank-by.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAmB,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAErE,OAAO,EAAE,KAAK,SAAS,EAA+B,MAAM,4BAA4B,CAAC;AAEzF;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,MAAM,CAAC,CAAC,EACtB,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,EACtB,IAAI,EAAE,CAAC,EACP,GAAG,KAAK,EAAE,QAAQ,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,GAC9C,MAAM,CAAC;AAEV;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,MAAM,CAAC,CAAC,EACtB,IAAI,EAAE,CAAC,EACP,GAAG,KAAK,EAAE,QAAQ,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,GAC9C,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
|
|
3
|
+
*
|
|
3
4
|
* @param items the array to reduce
|
|
4
5
|
* @param fn the callback function
|
|
5
6
|
* @param initialValue the initial value to use as an accumulator value in the callback function
|
|
@@ -16,6 +17,7 @@
|
|
|
16
17
|
export declare function reduce<T, K>(items: ReadonlyArray<T>, fn: (acc: K, item: T) => K, initialValue: K): K;
|
|
17
18
|
/**
|
|
18
19
|
* Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
|
|
20
|
+
*
|
|
19
21
|
* @param fn the callback function
|
|
20
22
|
* @param initialValue the initial value to use as an accumulator value in the callback function
|
|
21
23
|
* @signature
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reduce.d.ts","sourceRoot":"","sources":["../../../src/array/reduce.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"reduce.d.ts","sourceRoot":"","sources":["../../../src/array/reduce.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,CAAC,EACzB,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,EACvB,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,KAAK,CAAC,EAC1B,YAAY,EAAE,CAAC,GACd,CAAC,CAAC;AAEL;;;;;;;;;;;;;GAaG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,CAAC,EACzB,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,KAAK,CAAC,EAC1B,YAAY,EAAE,CAAC,GACd,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;AAmBlC,yBAAiB,MAAM,CAAC;IACtB,SAAgB,OAAO,CAAC,CAAC,EAAE,CAAC,EAC1B,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,EACvB,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,EAClE,YAAY,EAAE,CAAC,GACd,CAAC,CAAC;IACL,SAAgB,OAAO,CAAC,CAAC,EAAE,CAAC,EAC1B,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,EAClE,YAAY,EAAE,CAAC,GACd,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;CAInC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
type Reverse<T extends ReadonlyArray<unknown>, R extends ReadonlyArray<unknown> = []> = ReturnType<T extends IsNoTuple<T> ? () => [...T, ...R] : T extends readonly [infer F, ...infer L] ? () => Reverse<L, [F, ...R]> : () => R>;
|
|
2
2
|
type IsNoTuple<T> = T extends readonly [unknown, ...Array<unknown>] ? never : T;
|
|
3
3
|
/**
|
|
4
|
-
* Reverses array.
|
|
4
|
+
* Reverses an array.
|
|
5
|
+
*
|
|
5
6
|
* @param array the array
|
|
6
7
|
* @signature
|
|
7
8
|
* P.reverse(arr);
|
|
@@ -12,7 +13,8 @@ type IsNoTuple<T> = T extends readonly [unknown, ...Array<unknown>] ? never : T;
|
|
|
12
13
|
*/
|
|
13
14
|
export declare function reverse<T extends ReadonlyArray<unknown>>(array: T): Reverse<T>;
|
|
14
15
|
/**
|
|
15
|
-
* Reverses array.
|
|
16
|
+
* Reverses an array.
|
|
17
|
+
*
|
|
16
18
|
* @signature
|
|
17
19
|
* P.reverse()(array);
|
|
18
20
|
* @example
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reverse.d.ts","sourceRoot":"","sources":["../../../src/array/reverse.ts"],"names":[],"mappings":"AAEA,KAAK,OAAO,CACV,CAAC,SAAS,aAAa,CAAC,OAAO,CAAC,EAChC,CAAC,SAAS,aAAa,CAAC,OAA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;;;;;;GASG;AACH,wBAAgB,OAAO,CAAC,CAAC,SAAS,aAAa,CAAC,OAAO,CAAC,KAAK,CAC3D,KAAK,EAAE,CAAC,KACL,OAAO,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -13,7 +13,6 @@ import { type OrderRule } from '../utils/purry-order-rules';
|
|
|
13
13
|
* `rankBy` === `sortedIndex(sortBy(data, ...rules), item)`, O(n).
|
|
14
14
|
* Refer to the docs for more details.
|
|
15
15
|
*
|
|
16
|
-
* @param data - The input array.
|
|
17
16
|
* @param rules - A variadic array of order rules defining the sorting criteria. Each order rule is a projection function that extracts a comparable value from the data. Sorting is based on these extracted values using the native `<` and `>` operators. Earlier rules take precedence over later ones. Use the syntax `[projection, "desc"]` for descending order.
|
|
18
17
|
* @return - A shallow copy of the input array sorted by the provided rules.
|
|
19
18
|
* @signature
|
|
@@ -46,8 +45,8 @@ export declare function sortBy<T>(...rules: Readonly<NonEmptyArray<OrderRule<T>>
|
|
|
46
45
|
* `rankBy` === `sortedIndex(sortBy(data, ...rules), item)`, O(n).
|
|
47
46
|
* Refer to the docs for more details.
|
|
48
47
|
*
|
|
49
|
-
* @param
|
|
50
|
-
* @param
|
|
48
|
+
* @param array - The input array.
|
|
49
|
+
* @param sortRules - A variadic array of order rules defining the sorting criteria. Each order rule is a projection function that extracts a comparable value from the data. Sorting is based on these extracted values using the native `<` and `>` operators. Earlier rules take precedence over later ones. Use the syntax `[projection, "desc"]` for descending order.
|
|
51
50
|
* @return - A shallow copy of the input array sorted by the provided rules.
|
|
52
51
|
* @signature
|
|
53
52
|
* P.sortBy(data, ...rules)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sort-by.d.ts","sourceRoot":"","sources":["../../../src/array/sort-by.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAmB,iBAAiB,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAExF,OAAO,EAAE,KAAK,SAAS,EAAmB,MAAM,4BAA4B,CAAC;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,UAAU,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC;CACpC,CAAC;AAEF,yBAAiB,MAAM,CAAC;IACf,MAAM,MAAM,EAAE,MAAe,CAAC;CACtC"}
|
|
@@ -37,7 +37,6 @@ export declare function sortedIndexBy<T>(data: ReadonlyArray<T>, item: T, valueF
|
|
|
37
37
|
*
|
|
38
38
|
* Runs in O(logN) time.
|
|
39
39
|
*
|
|
40
|
-
* @param data - The (ascending) sorted array.
|
|
41
40
|
* @param item - The item to insert.
|
|
42
41
|
* @param valueFunction - All comparisons would be performed on the result of
|
|
43
42
|
* calling this function on each compared item. Preferably this function should
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sorted-index-by.d.ts","sourceRoot":"","sources":["../../../src/array/sorted-index-by.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAC7B,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,EACtB,IAAI,EAAE,CAAC,EACP,aAAa,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,WAAW,CAAC,OAAO,CAAC,GAC/C,MAAM,CAAC;AAEV
|
|
1
|
+
{"version":3,"file":"sorted-index-by.d.ts","sourceRoot":"","sources":["../../../src/array/sorted-index-by.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAC7B,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,EACtB,IAAI,EAAE,CAAC,EACP,aAAa,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,WAAW,CAAC,OAAO,CAAC,GAC/C,MAAM,CAAC;AAEV;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAC7B,IAAI,EAAE,CAAC,EACP,aAAa,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,WA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