Upload folder using huggingface_hub (part 15)
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- node_modules/es-toolkit/dist/fp/array/head.js +9 -0
- node_modules/es-toolkit/dist/fp/array/head.mjs +9 -0
- node_modules/es-toolkit/dist/fp/array/index.d.mts +69 -0
- node_modules/es-toolkit/dist/fp/array/index.d.ts +69 -0
- node_modules/es-toolkit/dist/fp/array/index.js +68 -0
- node_modules/es-toolkit/dist/fp/array/index.mjs +68 -0
- node_modules/es-toolkit/dist/fp/array/initial.d.mts +19 -0
- node_modules/es-toolkit/dist/fp/array/initial.d.ts +19 -0
- node_modules/es-toolkit/dist/fp/array/initial.js +24 -0
- node_modules/es-toolkit/dist/fp/array/initial.mjs +24 -0
- node_modules/es-toolkit/dist/fp/array/intersection.d.mts +21 -0
- node_modules/es-toolkit/dist/fp/array/intersection.d.ts +21 -0
- node_modules/es-toolkit/dist/fp/array/intersection.js +32 -0
- node_modules/es-toolkit/dist/fp/array/intersection.mjs +31 -0
- node_modules/es-toolkit/dist/fp/array/intersectionBy.d.mts +22 -0
- node_modules/es-toolkit/dist/fp/array/intersectionBy.d.ts +22 -0
- node_modules/es-toolkit/dist/fp/array/intersectionBy.js +33 -0
- node_modules/es-toolkit/dist/fp/array/intersectionBy.mjs +32 -0
- node_modules/es-toolkit/dist/fp/array/intersectionWith.d.mts +22 -0
- node_modules/es-toolkit/dist/fp/array/intersectionWith.d.ts +22 -0
- node_modules/es-toolkit/dist/fp/array/intersectionWith.js +32 -0
- node_modules/es-toolkit/dist/fp/array/intersectionWith.mjs +31 -0
- node_modules/es-toolkit/dist/fp/array/isSubset.d.mts +20 -0
- node_modules/es-toolkit/dist/fp/array/isSubset.d.ts +20 -0
- node_modules/es-toolkit/dist/fp/array/isSubset.js +25 -0
- node_modules/es-toolkit/dist/fp/array/isSubset.mjs +25 -0
- node_modules/es-toolkit/dist/fp/array/isSubsetWith.d.mts +21 -0
- node_modules/es-toolkit/dist/fp/array/isSubsetWith.d.ts +21 -0
- node_modules/es-toolkit/dist/fp/array/isSubsetWith.js +26 -0
- node_modules/es-toolkit/dist/fp/array/isSubsetWith.mjs +26 -0
- node_modules/es-toolkit/dist/fp/array/join.d.mts +20 -0
- node_modules/es-toolkit/dist/fp/array/join.d.ts +20 -0
- node_modules/es-toolkit/dist/fp/array/join.js +24 -0
- node_modules/es-toolkit/dist/fp/array/join.mjs +24 -0
- node_modules/es-toolkit/dist/fp/array/keyBy.d.mts +21 -0
- node_modules/es-toolkit/dist/fp/array/keyBy.d.ts +21 -0
- node_modules/es-toolkit/dist/fp/array/keyBy.js +26 -0
- node_modules/es-toolkit/dist/fp/array/keyBy.mjs +26 -0
- node_modules/es-toolkit/dist/fp/array/last.d.mts +35 -0
- node_modules/es-toolkit/dist/fp/array/last.d.ts +35 -0
- node_modules/es-toolkit/dist/fp/array/last.js +9 -0
- node_modules/es-toolkit/dist/fp/array/last.mjs +9 -0
- node_modules/es-toolkit/dist/fp/array/length.d.mts +18 -0
- node_modules/es-toolkit/dist/fp/array/length.d.ts +18 -0
- node_modules/es-toolkit/dist/fp/array/length.js +22 -0
- node_modules/es-toolkit/dist/fp/array/length.mjs +22 -0
- node_modules/es-toolkit/dist/fp/array/map.d.mts +27 -0
- node_modules/es-toolkit/dist/fp/array/map.d.ts +27 -0
- node_modules/es-toolkit/dist/fp/array/map.js +36 -0
- node_modules/es-toolkit/dist/fp/array/map.mjs +35 -0
node_modules/es-toolkit/dist/fp/array/head.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const require_head = require("../../array/head.js");
|
| 2 |
+
//#region src/fp/array/head.ts
|
| 3 |
+
function head() {
|
| 4 |
+
return function(array) {
|
| 5 |
+
return require_head.head(array);
|
| 6 |
+
};
|
| 7 |
+
}
|
| 8 |
+
//#endregion
|
| 9 |
+
exports.head = head;
|
node_modules/es-toolkit/dist/fp/array/head.mjs
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { head as head$1 } from "../../array/head.mjs";
|
| 2 |
+
//#region src/fp/array/head.ts
|
| 3 |
+
function head() {
|
| 4 |
+
return function(array) {
|
| 5 |
+
return head$1(array);
|
| 6 |
+
};
|
| 7 |
+
}
|
| 8 |
+
//#endregion
|
| 9 |
+
export { head };
|
node_modules/es-toolkit/dist/fp/array/index.d.mts
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { WindowedOptions } from "../../array/windowed.mjs";
|
| 2 |
+
import { at } from "./at.mjs";
|
| 3 |
+
import { cartesianProduct } from "./cartesianProduct.mjs";
|
| 4 |
+
import { chunk } from "./chunk.mjs";
|
| 5 |
+
import { chunkBy } from "./chunkBy.mjs";
|
| 6 |
+
import { combinations } from "./combinations.mjs";
|
| 7 |
+
import { compact } from "./compact.mjs";
|
| 8 |
+
import { countBy } from "./countBy.mjs";
|
| 9 |
+
import { difference } from "./difference.mjs";
|
| 10 |
+
import { differenceBy } from "./differenceBy.mjs";
|
| 11 |
+
import { differenceWith } from "./differenceWith.mjs";
|
| 12 |
+
import { drop } from "./drop.mjs";
|
| 13 |
+
import { dropRight } from "./dropRight.mjs";
|
| 14 |
+
import { dropRightWhile } from "./dropRightWhile.mjs";
|
| 15 |
+
import { dropWhile } from "./dropWhile.mjs";
|
| 16 |
+
import { filter } from "./filter.mjs";
|
| 17 |
+
import { find } from "./find.mjs";
|
| 18 |
+
import { findIndex } from "./findIndex.mjs";
|
| 19 |
+
import { findLast } from "./findLast.mjs";
|
| 20 |
+
import { findLastIndex } from "./findLastIndex.mjs";
|
| 21 |
+
import { flatMap } from "./flatMap.mjs";
|
| 22 |
+
import { flatMapDeep } from "./flatMapDeep.mjs";
|
| 23 |
+
import { flatten } from "./flatten.mjs";
|
| 24 |
+
import { flattenDeep } from "./flattenDeep.mjs";
|
| 25 |
+
import { forEach } from "./forEach.mjs";
|
| 26 |
+
import { groupBy } from "./groupBy.mjs";
|
| 27 |
+
import { head } from "./head.mjs";
|
| 28 |
+
import { initial } from "./initial.mjs";
|
| 29 |
+
import { intersection } from "./intersection.mjs";
|
| 30 |
+
import { intersectionBy } from "./intersectionBy.mjs";
|
| 31 |
+
import { intersectionWith } from "./intersectionWith.mjs";
|
| 32 |
+
import { isSubset } from "./isSubset.mjs";
|
| 33 |
+
import { isSubsetWith } from "./isSubsetWith.mjs";
|
| 34 |
+
import { join } from "./join.mjs";
|
| 35 |
+
import { keyBy } from "./keyBy.mjs";
|
| 36 |
+
import { last } from "./last.mjs";
|
| 37 |
+
import { length } from "./length.mjs";
|
| 38 |
+
import { map } from "./map.mjs";
|
| 39 |
+
import { maxBy } from "./maxBy.mjs";
|
| 40 |
+
import { minBy } from "./minBy.mjs";
|
| 41 |
+
import { orderBy } from "./orderBy.mjs";
|
| 42 |
+
import { partition } from "./partition.mjs";
|
| 43 |
+
import { reverse } from "./reverse.mjs";
|
| 44 |
+
import { sample } from "./sample.mjs";
|
| 45 |
+
import { sampleSize } from "./sampleSize.mjs";
|
| 46 |
+
import { shuffle } from "./shuffle.mjs";
|
| 47 |
+
import { sortBy } from "./sortBy.mjs";
|
| 48 |
+
import { tail } from "./tail.mjs";
|
| 49 |
+
import { take } from "./take.mjs";
|
| 50 |
+
import { takeRight } from "./takeRight.mjs";
|
| 51 |
+
import { takeRightWhile } from "./takeRightWhile.mjs";
|
| 52 |
+
import { takeWhile } from "./takeWhile.mjs";
|
| 53 |
+
import { toFilled } from "./toFilled.mjs";
|
| 54 |
+
import { union } from "./union.mjs";
|
| 55 |
+
import { unionBy } from "./unionBy.mjs";
|
| 56 |
+
import { unionWith } from "./unionWith.mjs";
|
| 57 |
+
import { uniq } from "./uniq.mjs";
|
| 58 |
+
import { uniqBy } from "./uniqBy.mjs";
|
| 59 |
+
import { uniqWith } from "./uniqWith.mjs";
|
| 60 |
+
import { unzip } from "./unzip.mjs";
|
| 61 |
+
import { unzipWith } from "./unzipWith.mjs";
|
| 62 |
+
import { windowed } from "./windowed.mjs";
|
| 63 |
+
import { without } from "./without.mjs";
|
| 64 |
+
import { xor } from "./xor.mjs";
|
| 65 |
+
import { xorBy } from "./xorBy.mjs";
|
| 66 |
+
import { xorWith } from "./xorWith.mjs";
|
| 67 |
+
import { zip } from "./zip.mjs";
|
| 68 |
+
import { zipObject } from "./zipObject.mjs";
|
| 69 |
+
import { zipWith } from "./zipWith.mjs";
|
node_modules/es-toolkit/dist/fp/array/index.d.ts
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { WindowedOptions } from "../../array/windowed.js";
|
| 2 |
+
import { at } from "./at.js";
|
| 3 |
+
import { cartesianProduct } from "./cartesianProduct.js";
|
| 4 |
+
import { chunk } from "./chunk.js";
|
| 5 |
+
import { chunkBy } from "./chunkBy.js";
|
| 6 |
+
import { combinations } from "./combinations.js";
|
| 7 |
+
import { compact } from "./compact.js";
|
| 8 |
+
import { countBy } from "./countBy.js";
|
| 9 |
+
import { difference } from "./difference.js";
|
| 10 |
+
import { differenceBy } from "./differenceBy.js";
|
| 11 |
+
import { differenceWith } from "./differenceWith.js";
|
| 12 |
+
import { drop } from "./drop.js";
|
| 13 |
+
import { dropRight } from "./dropRight.js";
|
| 14 |
+
import { dropRightWhile } from "./dropRightWhile.js";
|
| 15 |
+
import { dropWhile } from "./dropWhile.js";
|
| 16 |
+
import { filter } from "./filter.js";
|
| 17 |
+
import { find } from "./find.js";
|
| 18 |
+
import { findIndex } from "./findIndex.js";
|
| 19 |
+
import { findLast } from "./findLast.js";
|
| 20 |
+
import { findLastIndex } from "./findLastIndex.js";
|
| 21 |
+
import { flatMap } from "./flatMap.js";
|
| 22 |
+
import { flatMapDeep } from "./flatMapDeep.js";
|
| 23 |
+
import { flatten } from "./flatten.js";
|
| 24 |
+
import { flattenDeep } from "./flattenDeep.js";
|
| 25 |
+
import { forEach } from "./forEach.js";
|
| 26 |
+
import { groupBy } from "./groupBy.js";
|
| 27 |
+
import { head } from "./head.js";
|
| 28 |
+
import { initial } from "./initial.js";
|
| 29 |
+
import { intersection } from "./intersection.js";
|
| 30 |
+
import { intersectionBy } from "./intersectionBy.js";
|
| 31 |
+
import { intersectionWith } from "./intersectionWith.js";
|
| 32 |
+
import { isSubset } from "./isSubset.js";
|
| 33 |
+
import { isSubsetWith } from "./isSubsetWith.js";
|
| 34 |
+
import { join } from "./join.js";
|
| 35 |
+
import { keyBy } from "./keyBy.js";
|
| 36 |
+
import { last } from "./last.js";
|
| 37 |
+
import { length } from "./length.js";
|
| 38 |
+
import { map } from "./map.js";
|
| 39 |
+
import { maxBy } from "./maxBy.js";
|
| 40 |
+
import { minBy } from "./minBy.js";
|
| 41 |
+
import { orderBy } from "./orderBy.js";
|
| 42 |
+
import { partition } from "./partition.js";
|
| 43 |
+
import { reverse } from "./reverse.js";
|
| 44 |
+
import { sample } from "./sample.js";
|
| 45 |
+
import { sampleSize } from "./sampleSize.js";
|
| 46 |
+
import { shuffle } from "./shuffle.js";
|
| 47 |
+
import { sortBy } from "./sortBy.js";
|
| 48 |
+
import { tail } from "./tail.js";
|
| 49 |
+
import { take } from "./take.js";
|
| 50 |
+
import { takeRight } from "./takeRight.js";
|
| 51 |
+
import { takeRightWhile } from "./takeRightWhile.js";
|
| 52 |
+
import { takeWhile } from "./takeWhile.js";
|
| 53 |
+
import { toFilled } from "./toFilled.js";
|
| 54 |
+
import { union } from "./union.js";
|
| 55 |
+
import { unionBy } from "./unionBy.js";
|
| 56 |
+
import { unionWith } from "./unionWith.js";
|
| 57 |
+
import { uniq } from "./uniq.js";
|
| 58 |
+
import { uniqBy } from "./uniqBy.js";
|
| 59 |
+
import { uniqWith } from "./uniqWith.js";
|
| 60 |
+
import { unzip } from "./unzip.js";
|
| 61 |
+
import { unzipWith } from "./unzipWith.js";
|
| 62 |
+
import { windowed } from "./windowed.js";
|
| 63 |
+
import { without } from "./without.js";
|
| 64 |
+
import { xor } from "./xor.js";
|
| 65 |
+
import { xorBy } from "./xorBy.js";
|
| 66 |
+
import { xorWith } from "./xorWith.js";
|
| 67 |
+
import { zip } from "./zip.js";
|
| 68 |
+
import { zipObject } from "./zipObject.js";
|
| 69 |
+
import { zipWith } from "./zipWith.js";
|
node_modules/es-toolkit/dist/fp/array/index.js
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
require("./at.js");
|
| 2 |
+
require("./cartesianProduct.js");
|
| 3 |
+
require("./chunk.js");
|
| 4 |
+
require("./chunkBy.js");
|
| 5 |
+
require("./combinations.js");
|
| 6 |
+
require("./compact.js");
|
| 7 |
+
require("./countBy.js");
|
| 8 |
+
require("./difference.js");
|
| 9 |
+
require("./differenceBy.js");
|
| 10 |
+
require("./differenceWith.js");
|
| 11 |
+
require("./drop.js");
|
| 12 |
+
require("./dropRight.js");
|
| 13 |
+
require("./dropRightWhile.js");
|
| 14 |
+
require("./dropWhile.js");
|
| 15 |
+
require("./filter.js");
|
| 16 |
+
require("./find.js");
|
| 17 |
+
require("./findIndex.js");
|
| 18 |
+
require("./findLast.js");
|
| 19 |
+
require("./findLastIndex.js");
|
| 20 |
+
require("./flatMap.js");
|
| 21 |
+
require("./flatMapDeep.js");
|
| 22 |
+
require("./flatten.js");
|
| 23 |
+
require("./flattenDeep.js");
|
| 24 |
+
require("./forEach.js");
|
| 25 |
+
require("./groupBy.js");
|
| 26 |
+
require("./head.js");
|
| 27 |
+
require("./initial.js");
|
| 28 |
+
require("./intersection.js");
|
| 29 |
+
require("./intersectionBy.js");
|
| 30 |
+
require("./intersectionWith.js");
|
| 31 |
+
require("./isSubset.js");
|
| 32 |
+
require("./isSubsetWith.js");
|
| 33 |
+
require("./join.js");
|
| 34 |
+
require("./keyBy.js");
|
| 35 |
+
require("./last.js");
|
| 36 |
+
require("./length.js");
|
| 37 |
+
require("./map.js");
|
| 38 |
+
require("./maxBy.js");
|
| 39 |
+
require("./minBy.js");
|
| 40 |
+
require("./orderBy.js");
|
| 41 |
+
require("./partition.js");
|
| 42 |
+
require("./reverse.js");
|
| 43 |
+
require("./sample.js");
|
| 44 |
+
require("./sampleSize.js");
|
| 45 |
+
require("./shuffle.js");
|
| 46 |
+
require("./sortBy.js");
|
| 47 |
+
require("./tail.js");
|
| 48 |
+
require("./take.js");
|
| 49 |
+
require("./takeRight.js");
|
| 50 |
+
require("./takeRightWhile.js");
|
| 51 |
+
require("./takeWhile.js");
|
| 52 |
+
require("./toFilled.js");
|
| 53 |
+
require("./union.js");
|
| 54 |
+
require("./unionBy.js");
|
| 55 |
+
require("./unionWith.js");
|
| 56 |
+
require("./uniq.js");
|
| 57 |
+
require("./uniqBy.js");
|
| 58 |
+
require("./uniqWith.js");
|
| 59 |
+
require("./unzip.js");
|
| 60 |
+
require("./unzipWith.js");
|
| 61 |
+
require("./windowed.js");
|
| 62 |
+
require("./without.js");
|
| 63 |
+
require("./xor.js");
|
| 64 |
+
require("./xorBy.js");
|
| 65 |
+
require("./xorWith.js");
|
| 66 |
+
require("./zip.js");
|
| 67 |
+
require("./zipObject.js");
|
| 68 |
+
require("./zipWith.js");
|
node_modules/es-toolkit/dist/fp/array/index.mjs
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import "./at.mjs";
|
| 2 |
+
import "./cartesianProduct.mjs";
|
| 3 |
+
import "./chunk.mjs";
|
| 4 |
+
import "./chunkBy.mjs";
|
| 5 |
+
import "./combinations.mjs";
|
| 6 |
+
import "./compact.mjs";
|
| 7 |
+
import "./countBy.mjs";
|
| 8 |
+
import "./difference.mjs";
|
| 9 |
+
import "./differenceBy.mjs";
|
| 10 |
+
import "./differenceWith.mjs";
|
| 11 |
+
import "./drop.mjs";
|
| 12 |
+
import "./dropRight.mjs";
|
| 13 |
+
import "./dropRightWhile.mjs";
|
| 14 |
+
import "./dropWhile.mjs";
|
| 15 |
+
import "./filter.mjs";
|
| 16 |
+
import "./find.mjs";
|
| 17 |
+
import "./findIndex.mjs";
|
| 18 |
+
import "./findLast.mjs";
|
| 19 |
+
import "./findLastIndex.mjs";
|
| 20 |
+
import "./flatMap.mjs";
|
| 21 |
+
import "./flatMapDeep.mjs";
|
| 22 |
+
import "./flatten.mjs";
|
| 23 |
+
import "./flattenDeep.mjs";
|
| 24 |
+
import "./forEach.mjs";
|
| 25 |
+
import "./groupBy.mjs";
|
| 26 |
+
import "./head.mjs";
|
| 27 |
+
import "./initial.mjs";
|
| 28 |
+
import "./intersection.mjs";
|
| 29 |
+
import "./intersectionBy.mjs";
|
| 30 |
+
import "./intersectionWith.mjs";
|
| 31 |
+
import "./isSubset.mjs";
|
| 32 |
+
import "./isSubsetWith.mjs";
|
| 33 |
+
import "./join.mjs";
|
| 34 |
+
import "./keyBy.mjs";
|
| 35 |
+
import "./last.mjs";
|
| 36 |
+
import "./length.mjs";
|
| 37 |
+
import "./map.mjs";
|
| 38 |
+
import "./maxBy.mjs";
|
| 39 |
+
import "./minBy.mjs";
|
| 40 |
+
import "./orderBy.mjs";
|
| 41 |
+
import "./partition.mjs";
|
| 42 |
+
import "./reverse.mjs";
|
| 43 |
+
import "./sample.mjs";
|
| 44 |
+
import "./sampleSize.mjs";
|
| 45 |
+
import "./shuffle.mjs";
|
| 46 |
+
import "./sortBy.mjs";
|
| 47 |
+
import "./tail.mjs";
|
| 48 |
+
import "./take.mjs";
|
| 49 |
+
import "./takeRight.mjs";
|
| 50 |
+
import "./takeRightWhile.mjs";
|
| 51 |
+
import "./takeWhile.mjs";
|
| 52 |
+
import "./toFilled.mjs";
|
| 53 |
+
import "./union.mjs";
|
| 54 |
+
import "./unionBy.mjs";
|
| 55 |
+
import "./unionWith.mjs";
|
| 56 |
+
import "./uniq.mjs";
|
| 57 |
+
import "./uniqBy.mjs";
|
| 58 |
+
import "./uniqWith.mjs";
|
| 59 |
+
import "./unzip.mjs";
|
| 60 |
+
import "./unzipWith.mjs";
|
| 61 |
+
import "./windowed.mjs";
|
| 62 |
+
import "./without.mjs";
|
| 63 |
+
import "./xor.mjs";
|
| 64 |
+
import "./xorBy.mjs";
|
| 65 |
+
import "./xorWith.mjs";
|
| 66 |
+
import "./zip.mjs";
|
| 67 |
+
import "./zipObject.mjs";
|
| 68 |
+
import "./zipWith.mjs";
|
node_modules/es-toolkit/dist/fp/array/initial.d.mts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/fp/array/initial.d.ts
|
| 2 |
+
/**
|
| 3 |
+
* Creates a function that returns every element except the last one.
|
| 4 |
+
*
|
| 5 |
+
* The returned function follows the main {@link initial} behavior and always returns a new array.
|
| 6 |
+
* Use it with {@link pipe}.
|
| 7 |
+
*
|
| 8 |
+
* @template T - The type of elements in the array.
|
| 9 |
+
* @returns A function that maps a readonly array to its initial elements.
|
| 10 |
+
*
|
| 11 |
+
* @example
|
| 12 |
+
* import { initial, pipe } from 'es-toolkit/fp';
|
| 13 |
+
*
|
| 14 |
+
* pipe([1, 2, 3], initial());
|
| 15 |
+
* // => [1, 2]
|
| 16 |
+
*/
|
| 17 |
+
declare function initial<T>(): (array: readonly T[]) => T[];
|
| 18 |
+
//#endregion
|
| 19 |
+
export { initial };
|
node_modules/es-toolkit/dist/fp/array/initial.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/fp/array/initial.d.ts
|
| 2 |
+
/**
|
| 3 |
+
* Creates a function that returns every element except the last one.
|
| 4 |
+
*
|
| 5 |
+
* The returned function follows the main {@link initial} behavior and always returns a new array.
|
| 6 |
+
* Use it with {@link pipe}.
|
| 7 |
+
*
|
| 8 |
+
* @template T - The type of elements in the array.
|
| 9 |
+
* @returns A function that maps a readonly array to its initial elements.
|
| 10 |
+
*
|
| 11 |
+
* @example
|
| 12 |
+
* import { initial, pipe } from 'es-toolkit/fp';
|
| 13 |
+
*
|
| 14 |
+
* pipe([1, 2, 3], initial());
|
| 15 |
+
* // => [1, 2]
|
| 16 |
+
*/
|
| 17 |
+
declare function initial<T>(): (array: readonly T[]) => T[];
|
| 18 |
+
//#endregion
|
| 19 |
+
export { initial };
|
node_modules/es-toolkit/dist/fp/array/initial.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const require_initial = require("../../array/initial.js");
|
| 2 |
+
//#region src/fp/array/initial.ts
|
| 3 |
+
/**
|
| 4 |
+
* Creates a function that returns every element except the last one.
|
| 5 |
+
*
|
| 6 |
+
* The returned function follows the main {@link initial} behavior and always returns a new array.
|
| 7 |
+
* Use it with {@link pipe}.
|
| 8 |
+
*
|
| 9 |
+
* @template T - The type of elements in the array.
|
| 10 |
+
* @returns A function that maps a readonly array to its initial elements.
|
| 11 |
+
*
|
| 12 |
+
* @example
|
| 13 |
+
* import { initial, pipe } from 'es-toolkit/fp';
|
| 14 |
+
*
|
| 15 |
+
* pipe([1, 2, 3], initial());
|
| 16 |
+
* // => [1, 2]
|
| 17 |
+
*/
|
| 18 |
+
function initial() {
|
| 19 |
+
return function(array) {
|
| 20 |
+
return require_initial.initial(array);
|
| 21 |
+
};
|
| 22 |
+
}
|
| 23 |
+
//#endregion
|
| 24 |
+
exports.initial = initial;
|
node_modules/es-toolkit/dist/fp/array/initial.mjs
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { initial as initial$1 } from "../../array/initial.mjs";
|
| 2 |
+
//#region src/fp/array/initial.ts
|
| 3 |
+
/**
|
| 4 |
+
* Creates a function that returns every element except the last one.
|
| 5 |
+
*
|
| 6 |
+
* The returned function follows the main {@link initial} behavior and always returns a new array.
|
| 7 |
+
* Use it with {@link pipe}.
|
| 8 |
+
*
|
| 9 |
+
* @template T - The type of elements in the array.
|
| 10 |
+
* @returns A function that maps a readonly array to its initial elements.
|
| 11 |
+
*
|
| 12 |
+
* @example
|
| 13 |
+
* import { initial, pipe } from 'es-toolkit/fp';
|
| 14 |
+
*
|
| 15 |
+
* pipe([1, 2, 3], initial());
|
| 16 |
+
* // => [1, 2]
|
| 17 |
+
*/
|
| 18 |
+
function initial() {
|
| 19 |
+
return function(array) {
|
| 20 |
+
return initial$1(array);
|
| 21 |
+
};
|
| 22 |
+
}
|
| 23 |
+
//#endregion
|
| 24 |
+
export { initial };
|
node_modules/es-toolkit/dist/fp/array/intersection.d.mts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/fp/array/intersection.d.ts
|
| 2 |
+
/**
|
| 3 |
+
* Creates a function that keeps values from the piped array that are also present in another array.
|
| 4 |
+
*
|
| 5 |
+
* Equality follows SameValueZero through Set membership, matching the main
|
| 6 |
+
* {@link intersection} implementation. The returned function is lazy-capable
|
| 7 |
+
* inside {@link pipe}.
|
| 8 |
+
*
|
| 9 |
+
* @template T - The type of elements in the arrays.
|
| 10 |
+
* @param secondArray - Values to intersect with the piped array.
|
| 11 |
+
* @returns A function that maps the piped array to its intersection.
|
| 12 |
+
*
|
| 13 |
+
* @example
|
| 14 |
+
* import { intersection, pipe } from 'es-toolkit/fp';
|
| 15 |
+
*
|
| 16 |
+
* pipe([1, 2, 3], intersection([2, 4]));
|
| 17 |
+
* // => [2]
|
| 18 |
+
*/
|
| 19 |
+
declare function intersection<T>(secondArray: readonly T[]): (array: readonly T[]) => T[];
|
| 20 |
+
//#endregion
|
| 21 |
+
export { intersection };
|
node_modules/es-toolkit/dist/fp/array/intersection.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/fp/array/intersection.d.ts
|
| 2 |
+
/**
|
| 3 |
+
* Creates a function that keeps values from the piped array that are also present in another array.
|
| 4 |
+
*
|
| 5 |
+
* Equality follows SameValueZero through Set membership, matching the main
|
| 6 |
+
* {@link intersection} implementation. The returned function is lazy-capable
|
| 7 |
+
* inside {@link pipe}.
|
| 8 |
+
*
|
| 9 |
+
* @template T - The type of elements in the arrays.
|
| 10 |
+
* @param secondArray - Values to intersect with the piped array.
|
| 11 |
+
* @returns A function that maps the piped array to its intersection.
|
| 12 |
+
*
|
| 13 |
+
* @example
|
| 14 |
+
* import { intersection, pipe } from 'es-toolkit/fp';
|
| 15 |
+
*
|
| 16 |
+
* pipe([1, 2, 3], intersection([2, 4]));
|
| 17 |
+
* // => [2]
|
| 18 |
+
*/
|
| 19 |
+
declare function intersection<T>(secondArray: readonly T[]): (array: readonly T[]) => T[];
|
| 20 |
+
//#endregion
|
| 21 |
+
export { intersection };
|
node_modules/es-toolkit/dist/fp/array/intersection.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const require_intersection = require("../../array/intersection.js");
|
| 2 |
+
const require_lazy = require("../_internal/lazy.js");
|
| 3 |
+
//#region src/fp/array/intersection.ts
|
| 4 |
+
/**
|
| 5 |
+
* Creates a function that keeps values from the piped array that are also present in another array.
|
| 6 |
+
*
|
| 7 |
+
* Equality follows SameValueZero through Set membership, matching the main
|
| 8 |
+
* {@link intersection} implementation. The returned function is lazy-capable
|
| 9 |
+
* inside {@link pipe}.
|
| 10 |
+
*
|
| 11 |
+
* @template T - The type of elements in the arrays.
|
| 12 |
+
* @param secondArray - Values to intersect with the piped array.
|
| 13 |
+
* @returns A function that maps the piped array to its intersection.
|
| 14 |
+
*
|
| 15 |
+
* @example
|
| 16 |
+
* import { intersection, pipe } from 'es-toolkit/fp';
|
| 17 |
+
*
|
| 18 |
+
* pipe([1, 2, 3], intersection([2, 4]));
|
| 19 |
+
* // => [2]
|
| 20 |
+
*/
|
| 21 |
+
function intersection(secondArray) {
|
| 22 |
+
const secondSet = new Set(secondArray);
|
| 23 |
+
function intersectionEager(array) {
|
| 24 |
+
return require_intersection.intersection(array, secondArray);
|
| 25 |
+
}
|
| 26 |
+
const intersectionLazy = require_lazy.createLazyFunction((value, _index, emit) => {
|
| 27 |
+
if (secondSet.has(value)) emit(value);
|
| 28 |
+
});
|
| 29 |
+
return require_lazy.combineEagerAndLazyFunctions(intersectionEager, intersectionLazy);
|
| 30 |
+
}
|
| 31 |
+
//#endregion
|
| 32 |
+
exports.intersection = intersection;
|
node_modules/es-toolkit/dist/fp/array/intersection.mjs
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { intersection as intersection$1 } from "../../array/intersection.mjs";
|
| 2 |
+
import { combineEagerAndLazyFunctions, createLazyFunction } from "../_internal/lazy.mjs";
|
| 3 |
+
//#region src/fp/array/intersection.ts
|
| 4 |
+
/**
|
| 5 |
+
* Creates a function that keeps values from the piped array that are also present in another array.
|
| 6 |
+
*
|
| 7 |
+
* Equality follows SameValueZero through Set membership, matching the main
|
| 8 |
+
* {@link intersection} implementation. The returned function is lazy-capable
|
| 9 |
+
* inside {@link pipe}.
|
| 10 |
+
*
|
| 11 |
+
* @template T - The type of elements in the arrays.
|
| 12 |
+
* @param secondArray - Values to intersect with the piped array.
|
| 13 |
+
* @returns A function that maps the piped array to its intersection.
|
| 14 |
+
*
|
| 15 |
+
* @example
|
| 16 |
+
* import { intersection, pipe } from 'es-toolkit/fp';
|
| 17 |
+
*
|
| 18 |
+
* pipe([1, 2, 3], intersection([2, 4]));
|
| 19 |
+
* // => [2]
|
| 20 |
+
*/
|
| 21 |
+
function intersection(secondArray) {
|
| 22 |
+
const secondSet = new Set(secondArray);
|
| 23 |
+
function intersectionEager(array) {
|
| 24 |
+
return intersection$1(array, secondArray);
|
| 25 |
+
}
|
| 26 |
+
return combineEagerAndLazyFunctions(intersectionEager, createLazyFunction((value, _index, emit) => {
|
| 27 |
+
if (secondSet.has(value)) emit(value);
|
| 28 |
+
}));
|
| 29 |
+
}
|
| 30 |
+
//#endregion
|
| 31 |
+
export { intersection };
|
node_modules/es-toolkit/dist/fp/array/intersectionBy.d.mts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/fp/array/intersectionBy.d.ts
|
| 2 |
+
/**
|
| 3 |
+
* Creates a function that keeps values whose mapped identity appears in another array.
|
| 4 |
+
*
|
| 5 |
+
* The mapper is applied to values from both arrays. The returned function is
|
| 6 |
+
* lazy-capable inside {@link pipe}.
|
| 7 |
+
*
|
| 8 |
+
* @template T - The type of elements in the piped array.
|
| 9 |
+
* @template U - The type of elements in the configured array.
|
| 10 |
+
* @param secondArray - Values to intersect with the piped array after mapping.
|
| 11 |
+
* @param mapper - Maps values from both arrays to comparison keys.
|
| 12 |
+
* @returns A function that maps the piped array to its mapped intersection.
|
| 13 |
+
*
|
| 14 |
+
* @example
|
| 15 |
+
* import { intersectionBy, pipe } from 'es-toolkit/fp';
|
| 16 |
+
*
|
| 17 |
+
* pipe([{ id: 1 }, { id: 2 }], intersectionBy([2], value => typeof value === 'number' ? value : value.id));
|
| 18 |
+
* // => [{ id: 2 }]
|
| 19 |
+
*/
|
| 20 |
+
declare function intersectionBy<T, U>(secondArray: readonly U[], mapper: (value: T | U) => unknown): (array: readonly T[]) => T[];
|
| 21 |
+
//#endregion
|
| 22 |
+
export { intersectionBy };
|
node_modules/es-toolkit/dist/fp/array/intersectionBy.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/fp/array/intersectionBy.d.ts
|
| 2 |
+
/**
|
| 3 |
+
* Creates a function that keeps values whose mapped identity appears in another array.
|
| 4 |
+
*
|
| 5 |
+
* The mapper is applied to values from both arrays. The returned function is
|
| 6 |
+
* lazy-capable inside {@link pipe}.
|
| 7 |
+
*
|
| 8 |
+
* @template T - The type of elements in the piped array.
|
| 9 |
+
* @template U - The type of elements in the configured array.
|
| 10 |
+
* @param secondArray - Values to intersect with the piped array after mapping.
|
| 11 |
+
* @param mapper - Maps values from both arrays to comparison keys.
|
| 12 |
+
* @returns A function that maps the piped array to its mapped intersection.
|
| 13 |
+
*
|
| 14 |
+
* @example
|
| 15 |
+
* import { intersectionBy, pipe } from 'es-toolkit/fp';
|
| 16 |
+
*
|
| 17 |
+
* pipe([{ id: 1 }, { id: 2 }], intersectionBy([2], value => typeof value === 'number' ? value : value.id));
|
| 18 |
+
* // => [{ id: 2 }]
|
| 19 |
+
*/
|
| 20 |
+
declare function intersectionBy<T, U>(secondArray: readonly U[], mapper: (value: T | U) => unknown): (array: readonly T[]) => T[];
|
| 21 |
+
//#endregion
|
| 22 |
+
export { intersectionBy };
|
node_modules/es-toolkit/dist/fp/array/intersectionBy.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const require_intersectionBy = require("../../array/intersectionBy.js");
|
| 2 |
+
const require_lazy = require("../_internal/lazy.js");
|
| 3 |
+
//#region src/fp/array/intersectionBy.ts
|
| 4 |
+
/**
|
| 5 |
+
* Creates a function that keeps values whose mapped identity appears in another array.
|
| 6 |
+
*
|
| 7 |
+
* The mapper is applied to values from both arrays. The returned function is
|
| 8 |
+
* lazy-capable inside {@link pipe}.
|
| 9 |
+
*
|
| 10 |
+
* @template T - The type of elements in the piped array.
|
| 11 |
+
* @template U - The type of elements in the configured array.
|
| 12 |
+
* @param secondArray - Values to intersect with the piped array after mapping.
|
| 13 |
+
* @param mapper - Maps values from both arrays to comparison keys.
|
| 14 |
+
* @returns A function that maps the piped array to its mapped intersection.
|
| 15 |
+
*
|
| 16 |
+
* @example
|
| 17 |
+
* import { intersectionBy, pipe } from 'es-toolkit/fp';
|
| 18 |
+
*
|
| 19 |
+
* pipe([{ id: 1 }, { id: 2 }], intersectionBy([2], value => typeof value === 'number' ? value : value.id));
|
| 20 |
+
* // => [{ id: 2 }]
|
| 21 |
+
*/
|
| 22 |
+
function intersectionBy(secondArray, mapper) {
|
| 23 |
+
const mappedSecondSet = new Set(secondArray.map((item) => mapper(item)));
|
| 24 |
+
function intersectionByEager(array) {
|
| 25 |
+
return require_intersectionBy.intersectionBy(array, secondArray, mapper);
|
| 26 |
+
}
|
| 27 |
+
const intersectionByLazy = require_lazy.createLazyFunction((value, _index, emit) => {
|
| 28 |
+
if (mappedSecondSet.has(mapper(value))) emit(value);
|
| 29 |
+
});
|
| 30 |
+
return require_lazy.combineEagerAndLazyFunctions(intersectionByEager, intersectionByLazy);
|
| 31 |
+
}
|
| 32 |
+
//#endregion
|
| 33 |
+
exports.intersectionBy = intersectionBy;
|
node_modules/es-toolkit/dist/fp/array/intersectionBy.mjs
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { intersectionBy as intersectionBy$1 } from "../../array/intersectionBy.mjs";
|
| 2 |
+
import { combineEagerAndLazyFunctions, createLazyFunction } from "../_internal/lazy.mjs";
|
| 3 |
+
//#region src/fp/array/intersectionBy.ts
|
| 4 |
+
/**
|
| 5 |
+
* Creates a function that keeps values whose mapped identity appears in another array.
|
| 6 |
+
*
|
| 7 |
+
* The mapper is applied to values from both arrays. The returned function is
|
| 8 |
+
* lazy-capable inside {@link pipe}.
|
| 9 |
+
*
|
| 10 |
+
* @template T - The type of elements in the piped array.
|
| 11 |
+
* @template U - The type of elements in the configured array.
|
| 12 |
+
* @param secondArray - Values to intersect with the piped array after mapping.
|
| 13 |
+
* @param mapper - Maps values from both arrays to comparison keys.
|
| 14 |
+
* @returns A function that maps the piped array to its mapped intersection.
|
| 15 |
+
*
|
| 16 |
+
* @example
|
| 17 |
+
* import { intersectionBy, pipe } from 'es-toolkit/fp';
|
| 18 |
+
*
|
| 19 |
+
* pipe([{ id: 1 }, { id: 2 }], intersectionBy([2], value => typeof value === 'number' ? value : value.id));
|
| 20 |
+
* // => [{ id: 2 }]
|
| 21 |
+
*/
|
| 22 |
+
function intersectionBy(secondArray, mapper) {
|
| 23 |
+
const mappedSecondSet = new Set(secondArray.map((item) => mapper(item)));
|
| 24 |
+
function intersectionByEager(array) {
|
| 25 |
+
return intersectionBy$1(array, secondArray, mapper);
|
| 26 |
+
}
|
| 27 |
+
return combineEagerAndLazyFunctions(intersectionByEager, createLazyFunction((value, _index, emit) => {
|
| 28 |
+
if (mappedSecondSet.has(mapper(value))) emit(value);
|
| 29 |
+
}));
|
| 30 |
+
}
|
| 31 |
+
//#endregion
|
| 32 |
+
export { intersectionBy };
|
node_modules/es-toolkit/dist/fp/array/intersectionWith.d.mts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/fp/array/intersectionWith.d.ts
|
| 2 |
+
/**
|
| 3 |
+
* Creates a function that keeps values equal to at least one configured value.
|
| 4 |
+
*
|
| 5 |
+
* Equality is decided by the provided comparator. The returned function is
|
| 6 |
+
* lazy-capable inside {@link pipe}.
|
| 7 |
+
*
|
| 8 |
+
* @template T - The type of elements in the piped array.
|
| 9 |
+
* @template U - The type of elements in the configured array.
|
| 10 |
+
* @param secondArray - Values to compare against the piped array.
|
| 11 |
+
* @param areItemsEqual - Returns true when a piped value equals a configured value.
|
| 12 |
+
* @returns A function that maps the piped array to its custom intersection.
|
| 13 |
+
*
|
| 14 |
+
* @example
|
| 15 |
+
* import { intersectionWith, pipe } from 'es-toolkit/fp';
|
| 16 |
+
*
|
| 17 |
+
* pipe([{ id: 1 }, { id: 2 }], intersectionWith([2], (item, id) => item.id === id));
|
| 18 |
+
* // => [{ id: 2 }]
|
| 19 |
+
*/
|
| 20 |
+
declare function intersectionWith<T, U>(secondArray: readonly U[], areItemsEqual: (item: T, other: U) => boolean): (array: readonly T[]) => T[];
|
| 21 |
+
//#endregion
|
| 22 |
+
export { intersectionWith };
|
node_modules/es-toolkit/dist/fp/array/intersectionWith.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/fp/array/intersectionWith.d.ts
|
| 2 |
+
/**
|
| 3 |
+
* Creates a function that keeps values equal to at least one configured value.
|
| 4 |
+
*
|
| 5 |
+
* Equality is decided by the provided comparator. The returned function is
|
| 6 |
+
* lazy-capable inside {@link pipe}.
|
| 7 |
+
*
|
| 8 |
+
* @template T - The type of elements in the piped array.
|
| 9 |
+
* @template U - The type of elements in the configured array.
|
| 10 |
+
* @param secondArray - Values to compare against the piped array.
|
| 11 |
+
* @param areItemsEqual - Returns true when a piped value equals a configured value.
|
| 12 |
+
* @returns A function that maps the piped array to its custom intersection.
|
| 13 |
+
*
|
| 14 |
+
* @example
|
| 15 |
+
* import { intersectionWith, pipe } from 'es-toolkit/fp';
|
| 16 |
+
*
|
| 17 |
+
* pipe([{ id: 1 }, { id: 2 }], intersectionWith([2], (item, id) => item.id === id));
|
| 18 |
+
* // => [{ id: 2 }]
|
| 19 |
+
*/
|
| 20 |
+
declare function intersectionWith<T, U>(secondArray: readonly U[], areItemsEqual: (item: T, other: U) => boolean): (array: readonly T[]) => T[];
|
| 21 |
+
//#endregion
|
| 22 |
+
export { intersectionWith };
|
node_modules/es-toolkit/dist/fp/array/intersectionWith.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const require_intersectionWith = require("../../array/intersectionWith.js");
|
| 2 |
+
const require_lazy = require("../_internal/lazy.js");
|
| 3 |
+
//#region src/fp/array/intersectionWith.ts
|
| 4 |
+
/**
|
| 5 |
+
* Creates a function that keeps values equal to at least one configured value.
|
| 6 |
+
*
|
| 7 |
+
* Equality is decided by the provided comparator. The returned function is
|
| 8 |
+
* lazy-capable inside {@link pipe}.
|
| 9 |
+
*
|
| 10 |
+
* @template T - The type of elements in the piped array.
|
| 11 |
+
* @template U - The type of elements in the configured array.
|
| 12 |
+
* @param secondArray - Values to compare against the piped array.
|
| 13 |
+
* @param areItemsEqual - Returns true when a piped value equals a configured value.
|
| 14 |
+
* @returns A function that maps the piped array to its custom intersection.
|
| 15 |
+
*
|
| 16 |
+
* @example
|
| 17 |
+
* import { intersectionWith, pipe } from 'es-toolkit/fp';
|
| 18 |
+
*
|
| 19 |
+
* pipe([{ id: 1 }, { id: 2 }], intersectionWith([2], (item, id) => item.id === id));
|
| 20 |
+
* // => [{ id: 2 }]
|
| 21 |
+
*/
|
| 22 |
+
function intersectionWith(secondArray, areItemsEqual) {
|
| 23 |
+
function intersectionWithEager(array) {
|
| 24 |
+
return require_intersectionWith.intersectionWith(array, secondArray, areItemsEqual);
|
| 25 |
+
}
|
| 26 |
+
const intersectionWithLazy = require_lazy.createLazyFunction((value, _index, emit) => {
|
| 27 |
+
if (secondArray.some((other) => areItemsEqual(value, other))) emit(value);
|
| 28 |
+
});
|
| 29 |
+
return require_lazy.combineEagerAndLazyFunctions(intersectionWithEager, intersectionWithLazy);
|
| 30 |
+
}
|
| 31 |
+
//#endregion
|
| 32 |
+
exports.intersectionWith = intersectionWith;
|
node_modules/es-toolkit/dist/fp/array/intersectionWith.mjs
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { intersectionWith as intersectionWith$1 } from "../../array/intersectionWith.mjs";
|
| 2 |
+
import { combineEagerAndLazyFunctions, createLazyFunction } from "../_internal/lazy.mjs";
|
| 3 |
+
//#region src/fp/array/intersectionWith.ts
|
| 4 |
+
/**
|
| 5 |
+
* Creates a function that keeps values equal to at least one configured value.
|
| 6 |
+
*
|
| 7 |
+
* Equality is decided by the provided comparator. The returned function is
|
| 8 |
+
* lazy-capable inside {@link pipe}.
|
| 9 |
+
*
|
| 10 |
+
* @template T - The type of elements in the piped array.
|
| 11 |
+
* @template U - The type of elements in the configured array.
|
| 12 |
+
* @param secondArray - Values to compare against the piped array.
|
| 13 |
+
* @param areItemsEqual - Returns true when a piped value equals a configured value.
|
| 14 |
+
* @returns A function that maps the piped array to its custom intersection.
|
| 15 |
+
*
|
| 16 |
+
* @example
|
| 17 |
+
* import { intersectionWith, pipe } from 'es-toolkit/fp';
|
| 18 |
+
*
|
| 19 |
+
* pipe([{ id: 1 }, { id: 2 }], intersectionWith([2], (item, id) => item.id === id));
|
| 20 |
+
* // => [{ id: 2 }]
|
| 21 |
+
*/
|
| 22 |
+
function intersectionWith(secondArray, areItemsEqual) {
|
| 23 |
+
function intersectionWithEager(array) {
|
| 24 |
+
return intersectionWith$1(array, secondArray, areItemsEqual);
|
| 25 |
+
}
|
| 26 |
+
return combineEagerAndLazyFunctions(intersectionWithEager, createLazyFunction((value, _index, emit) => {
|
| 27 |
+
if (secondArray.some((other) => areItemsEqual(value, other))) emit(value);
|
| 28 |
+
}));
|
| 29 |
+
}
|
| 30 |
+
//#endregion
|
| 31 |
+
export { intersectionWith };
|
node_modules/es-toolkit/dist/fp/array/isSubset.d.mts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/fp/array/isSubset.d.ts
|
| 2 |
+
/**
|
| 3 |
+
* Creates a predicate that checks whether the piped array is a subset of superset.
|
| 4 |
+
*
|
| 5 |
+
* Every value in the piped array must be present in superset, using the main
|
| 6 |
+
* {@link isSubset} equality behavior.
|
| 7 |
+
*
|
| 8 |
+
* @template T - The type of elements in the arrays.
|
| 9 |
+
* @param superset - The array that may contain all values from the piped array.
|
| 10 |
+
* @returns A predicate for the piped array.
|
| 11 |
+
*
|
| 12 |
+
* @example
|
| 13 |
+
* import { isSubset, pipe } from 'es-toolkit/fp';
|
| 14 |
+
*
|
| 15 |
+
* pipe([1, 2], isSubset([1, 2, 3]));
|
| 16 |
+
* // => true
|
| 17 |
+
*/
|
| 18 |
+
declare function isSubset<T>(superset: readonly T[]): (array: readonly T[]) => boolean;
|
| 19 |
+
//#endregion
|
| 20 |
+
export { isSubset };
|
node_modules/es-toolkit/dist/fp/array/isSubset.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/fp/array/isSubset.d.ts
|
| 2 |
+
/**
|
| 3 |
+
* Creates a predicate that checks whether the piped array is a subset of superset.
|
| 4 |
+
*
|
| 5 |
+
* Every value in the piped array must be present in superset, using the main
|
| 6 |
+
* {@link isSubset} equality behavior.
|
| 7 |
+
*
|
| 8 |
+
* @template T - The type of elements in the arrays.
|
| 9 |
+
* @param superset - The array that may contain all values from the piped array.
|
| 10 |
+
* @returns A predicate for the piped array.
|
| 11 |
+
*
|
| 12 |
+
* @example
|
| 13 |
+
* import { isSubset, pipe } from 'es-toolkit/fp';
|
| 14 |
+
*
|
| 15 |
+
* pipe([1, 2], isSubset([1, 2, 3]));
|
| 16 |
+
* // => true
|
| 17 |
+
*/
|
| 18 |
+
declare function isSubset<T>(superset: readonly T[]): (array: readonly T[]) => boolean;
|
| 19 |
+
//#endregion
|
| 20 |
+
export { isSubset };
|
node_modules/es-toolkit/dist/fp/array/isSubset.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const require_isSubset = require("../../array/isSubset.js");
|
| 2 |
+
//#region src/fp/array/isSubset.ts
|
| 3 |
+
/**
|
| 4 |
+
* Creates a predicate that checks whether the piped array is a subset of superset.
|
| 5 |
+
*
|
| 6 |
+
* Every value in the piped array must be present in superset, using the main
|
| 7 |
+
* {@link isSubset} equality behavior.
|
| 8 |
+
*
|
| 9 |
+
* @template T - The type of elements in the arrays.
|
| 10 |
+
* @param superset - The array that may contain all values from the piped array.
|
| 11 |
+
* @returns A predicate for the piped array.
|
| 12 |
+
*
|
| 13 |
+
* @example
|
| 14 |
+
* import { isSubset, pipe } from 'es-toolkit/fp';
|
| 15 |
+
*
|
| 16 |
+
* pipe([1, 2], isSubset([1, 2, 3]));
|
| 17 |
+
* // => true
|
| 18 |
+
*/
|
| 19 |
+
function isSubset(superset) {
|
| 20 |
+
return function(array) {
|
| 21 |
+
return require_isSubset.isSubset(superset, array);
|
| 22 |
+
};
|
| 23 |
+
}
|
| 24 |
+
//#endregion
|
| 25 |
+
exports.isSubset = isSubset;
|
node_modules/es-toolkit/dist/fp/array/isSubset.mjs
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { isSubset as isSubset$1 } from "../../array/isSubset.mjs";
|
| 2 |
+
//#region src/fp/array/isSubset.ts
|
| 3 |
+
/**
|
| 4 |
+
* Creates a predicate that checks whether the piped array is a subset of superset.
|
| 5 |
+
*
|
| 6 |
+
* Every value in the piped array must be present in superset, using the main
|
| 7 |
+
* {@link isSubset} equality behavior.
|
| 8 |
+
*
|
| 9 |
+
* @template T - The type of elements in the arrays.
|
| 10 |
+
* @param superset - The array that may contain all values from the piped array.
|
| 11 |
+
* @returns A predicate for the piped array.
|
| 12 |
+
*
|
| 13 |
+
* @example
|
| 14 |
+
* import { isSubset, pipe } from 'es-toolkit/fp';
|
| 15 |
+
*
|
| 16 |
+
* pipe([1, 2], isSubset([1, 2, 3]));
|
| 17 |
+
* // => true
|
| 18 |
+
*/
|
| 19 |
+
function isSubset(superset) {
|
| 20 |
+
return function(array) {
|
| 21 |
+
return isSubset$1(superset, array);
|
| 22 |
+
};
|
| 23 |
+
}
|
| 24 |
+
//#endregion
|
| 25 |
+
export { isSubset };
|
node_modules/es-toolkit/dist/fp/array/isSubsetWith.d.mts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/fp/array/isSubsetWith.d.ts
|
| 2 |
+
/**
|
| 3 |
+
* Creates a predicate that checks subset membership with a custom equality function.
|
| 4 |
+
*
|
| 5 |
+
* Every value in the piped array must match at least one value in superset according
|
| 6 |
+
* to areItemsEqual.
|
| 7 |
+
*
|
| 8 |
+
* @template T - The type of elements in the arrays.
|
| 9 |
+
* @param superset - The array that may contain all values from the piped array.
|
| 10 |
+
* @param areItemsEqual - Returns true when a piped value and a superset value are equal.
|
| 11 |
+
* @returns A predicate for the piped array.
|
| 12 |
+
*
|
| 13 |
+
* @example
|
| 14 |
+
* import { isSubsetWith, pipe } from 'es-toolkit/fp';
|
| 15 |
+
*
|
| 16 |
+
* pipe([{ id: 1 }], isSubsetWith([{ id: 1 }, { id: 2 }], (a, b) => a.id === b.id));
|
| 17 |
+
* // => true
|
| 18 |
+
*/
|
| 19 |
+
declare function isSubsetWith<T>(superset: readonly T[], areItemsEqual: (item: T, other: T) => boolean): (array: readonly T[]) => boolean;
|
| 20 |
+
//#endregion
|
| 21 |
+
export { isSubsetWith };
|
node_modules/es-toolkit/dist/fp/array/isSubsetWith.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/fp/array/isSubsetWith.d.ts
|
| 2 |
+
/**
|
| 3 |
+
* Creates a predicate that checks subset membership with a custom equality function.
|
| 4 |
+
*
|
| 5 |
+
* Every value in the piped array must match at least one value in superset according
|
| 6 |
+
* to areItemsEqual.
|
| 7 |
+
*
|
| 8 |
+
* @template T - The type of elements in the arrays.
|
| 9 |
+
* @param superset - The array that may contain all values from the piped array.
|
| 10 |
+
* @param areItemsEqual - Returns true when a piped value and a superset value are equal.
|
| 11 |
+
* @returns A predicate for the piped array.
|
| 12 |
+
*
|
| 13 |
+
* @example
|
| 14 |
+
* import { isSubsetWith, pipe } from 'es-toolkit/fp';
|
| 15 |
+
*
|
| 16 |
+
* pipe([{ id: 1 }], isSubsetWith([{ id: 1 }, { id: 2 }], (a, b) => a.id === b.id));
|
| 17 |
+
* // => true
|
| 18 |
+
*/
|
| 19 |
+
declare function isSubsetWith<T>(superset: readonly T[], areItemsEqual: (item: T, other: T) => boolean): (array: readonly T[]) => boolean;
|
| 20 |
+
//#endregion
|
| 21 |
+
export { isSubsetWith };
|
node_modules/es-toolkit/dist/fp/array/isSubsetWith.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const require_isSubsetWith = require("../../array/isSubsetWith.js");
|
| 2 |
+
//#region src/fp/array/isSubsetWith.ts
|
| 3 |
+
/**
|
| 4 |
+
* Creates a predicate that checks subset membership with a custom equality function.
|
| 5 |
+
*
|
| 6 |
+
* Every value in the piped array must match at least one value in superset according
|
| 7 |
+
* to areItemsEqual.
|
| 8 |
+
*
|
| 9 |
+
* @template T - The type of elements in the arrays.
|
| 10 |
+
* @param superset - The array that may contain all values from the piped array.
|
| 11 |
+
* @param areItemsEqual - Returns true when a piped value and a superset value are equal.
|
| 12 |
+
* @returns A predicate for the piped array.
|
| 13 |
+
*
|
| 14 |
+
* @example
|
| 15 |
+
* import { isSubsetWith, pipe } from 'es-toolkit/fp';
|
| 16 |
+
*
|
| 17 |
+
* pipe([{ id: 1 }], isSubsetWith([{ id: 1 }, { id: 2 }], (a, b) => a.id === b.id));
|
| 18 |
+
* // => true
|
| 19 |
+
*/
|
| 20 |
+
function isSubsetWith(superset, areItemsEqual) {
|
| 21 |
+
return function(array) {
|
| 22 |
+
return require_isSubsetWith.isSubsetWith(superset, array, areItemsEqual);
|
| 23 |
+
};
|
| 24 |
+
}
|
| 25 |
+
//#endregion
|
| 26 |
+
exports.isSubsetWith = isSubsetWith;
|
node_modules/es-toolkit/dist/fp/array/isSubsetWith.mjs
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { isSubsetWith as isSubsetWith$1 } from "../../array/isSubsetWith.mjs";
|
| 2 |
+
//#region src/fp/array/isSubsetWith.ts
|
| 3 |
+
/**
|
| 4 |
+
* Creates a predicate that checks subset membership with a custom equality function.
|
| 5 |
+
*
|
| 6 |
+
* Every value in the piped array must match at least one value in superset according
|
| 7 |
+
* to areItemsEqual.
|
| 8 |
+
*
|
| 9 |
+
* @template T - The type of elements in the arrays.
|
| 10 |
+
* @param superset - The array that may contain all values from the piped array.
|
| 11 |
+
* @param areItemsEqual - Returns true when a piped value and a superset value are equal.
|
| 12 |
+
* @returns A predicate for the piped array.
|
| 13 |
+
*
|
| 14 |
+
* @example
|
| 15 |
+
* import { isSubsetWith, pipe } from 'es-toolkit/fp';
|
| 16 |
+
*
|
| 17 |
+
* pipe([{ id: 1 }], isSubsetWith([{ id: 1 }, { id: 2 }], (a, b) => a.id === b.id));
|
| 18 |
+
* // => true
|
| 19 |
+
*/
|
| 20 |
+
function isSubsetWith(superset, areItemsEqual) {
|
| 21 |
+
return function(array) {
|
| 22 |
+
return isSubsetWith$1(superset, array, areItemsEqual);
|
| 23 |
+
};
|
| 24 |
+
}
|
| 25 |
+
//#endregion
|
| 26 |
+
export { isSubsetWith };
|
node_modules/es-toolkit/dist/fp/array/join.d.mts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/fp/array/join.d.ts
|
| 2 |
+
/**
|
| 3 |
+
* Creates a function that joins array values into a string.
|
| 4 |
+
*
|
| 5 |
+
* The separator is passed to Array.prototype.join, so undefined uses a comma.
|
| 6 |
+
* Use the returned function with {@link pipe}.
|
| 7 |
+
*
|
| 8 |
+
* @template T - The type of elements in the array.
|
| 9 |
+
* @param separator - The separator placed between values.
|
| 10 |
+
* @returns A function that maps a readonly array to a joined string.
|
| 11 |
+
*
|
| 12 |
+
* @example
|
| 13 |
+
* import { join, pipe } from 'es-toolkit/fp';
|
| 14 |
+
*
|
| 15 |
+
* pipe(['a', 'b', 'c'], join('-'));
|
| 16 |
+
* // => 'a-b-c'
|
| 17 |
+
*/
|
| 18 |
+
declare function join<T>(separator?: string): (array: readonly T[]) => string;
|
| 19 |
+
//#endregion
|
| 20 |
+
export { join };
|
node_modules/es-toolkit/dist/fp/array/join.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/fp/array/join.d.ts
|
| 2 |
+
/**
|
| 3 |
+
* Creates a function that joins array values into a string.
|
| 4 |
+
*
|
| 5 |
+
* The separator is passed to Array.prototype.join, so undefined uses a comma.
|
| 6 |
+
* Use the returned function with {@link pipe}.
|
| 7 |
+
*
|
| 8 |
+
* @template T - The type of elements in the array.
|
| 9 |
+
* @param separator - The separator placed between values.
|
| 10 |
+
* @returns A function that maps a readonly array to a joined string.
|
| 11 |
+
*
|
| 12 |
+
* @example
|
| 13 |
+
* import { join, pipe } from 'es-toolkit/fp';
|
| 14 |
+
*
|
| 15 |
+
* pipe(['a', 'b', 'c'], join('-'));
|
| 16 |
+
* // => 'a-b-c'
|
| 17 |
+
*/
|
| 18 |
+
declare function join<T>(separator?: string): (array: readonly T[]) => string;
|
| 19 |
+
//#endregion
|
| 20 |
+
export { join };
|
node_modules/es-toolkit/dist/fp/array/join.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/fp/array/join.ts
|
| 2 |
+
/**
|
| 3 |
+
* Creates a function that joins array values into a string.
|
| 4 |
+
*
|
| 5 |
+
* The separator is passed to Array.prototype.join, so undefined uses a comma.
|
| 6 |
+
* Use the returned function with {@link pipe}.
|
| 7 |
+
*
|
| 8 |
+
* @template T - The type of elements in the array.
|
| 9 |
+
* @param separator - The separator placed between values.
|
| 10 |
+
* @returns A function that maps a readonly array to a joined string.
|
| 11 |
+
*
|
| 12 |
+
* @example
|
| 13 |
+
* import { join, pipe } from 'es-toolkit/fp';
|
| 14 |
+
*
|
| 15 |
+
* pipe(['a', 'b', 'c'], join('-'));
|
| 16 |
+
* // => 'a-b-c'
|
| 17 |
+
*/
|
| 18 |
+
function join(separator) {
|
| 19 |
+
return function(array) {
|
| 20 |
+
return array.join(separator);
|
| 21 |
+
};
|
| 22 |
+
}
|
| 23 |
+
//#endregion
|
| 24 |
+
exports.join = join;
|
node_modules/es-toolkit/dist/fp/array/join.mjs
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/fp/array/join.ts
|
| 2 |
+
/**
|
| 3 |
+
* Creates a function that joins array values into a string.
|
| 4 |
+
*
|
| 5 |
+
* The separator is passed to Array.prototype.join, so undefined uses a comma.
|
| 6 |
+
* Use the returned function with {@link pipe}.
|
| 7 |
+
*
|
| 8 |
+
* @template T - The type of elements in the array.
|
| 9 |
+
* @param separator - The separator placed between values.
|
| 10 |
+
* @returns A function that maps a readonly array to a joined string.
|
| 11 |
+
*
|
| 12 |
+
* @example
|
| 13 |
+
* import { join, pipe } from 'es-toolkit/fp';
|
| 14 |
+
*
|
| 15 |
+
* pipe(['a', 'b', 'c'], join('-'));
|
| 16 |
+
* // => 'a-b-c'
|
| 17 |
+
*/
|
| 18 |
+
function join(separator) {
|
| 19 |
+
return function(array) {
|
| 20 |
+
return array.join(separator);
|
| 21 |
+
};
|
| 22 |
+
}
|
| 23 |
+
//#endregion
|
| 24 |
+
export { join };
|
node_modules/es-toolkit/dist/fp/array/keyBy.d.mts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/fp/array/keyBy.d.ts
|
| 2 |
+
/**
|
| 3 |
+
* Creates a function that indexes values by a derived key.
|
| 4 |
+
*
|
| 5 |
+
* The key selector receives each value, index, and full input array. When multiple values
|
| 6 |
+
* produce the same key, the last value wins, matching the main {@link keyBy} behavior.
|
| 7 |
+
*
|
| 8 |
+
* @template T - The type of elements in the array.
|
| 9 |
+
* @template K - The property-key type produced by the selector.
|
| 10 |
+
* @param getKey - Called with each value, index, and array to produce an object key.
|
| 11 |
+
* @returns A function that maps a readonly array to an object keyed by the derived keys.
|
| 12 |
+
*
|
| 13 |
+
* @example
|
| 14 |
+
* import { keyBy, pipe } from 'es-toolkit/fp';
|
| 15 |
+
*
|
| 16 |
+
* pipe([{ id: 'a', value: 1 }, { id: 'b', value: 2 }], keyBy(item => item.id));
|
| 17 |
+
* // => { a: { id: 'a', value: 1 }, b: { id: 'b', value: 2 } }
|
| 18 |
+
*/
|
| 19 |
+
declare function keyBy<T, K extends PropertyKey>(getKey: (item: T, index: number, array: readonly T[]) => K): (array: readonly T[]) => Record<K, T>;
|
| 20 |
+
//#endregion
|
| 21 |
+
export { keyBy };
|
node_modules/es-toolkit/dist/fp/array/keyBy.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/fp/array/keyBy.d.ts
|
| 2 |
+
/**
|
| 3 |
+
* Creates a function that indexes values by a derived key.
|
| 4 |
+
*
|
| 5 |
+
* The key selector receives each value, index, and full input array. When multiple values
|
| 6 |
+
* produce the same key, the last value wins, matching the main {@link keyBy} behavior.
|
| 7 |
+
*
|
| 8 |
+
* @template T - The type of elements in the array.
|
| 9 |
+
* @template K - The property-key type produced by the selector.
|
| 10 |
+
* @param getKey - Called with each value, index, and array to produce an object key.
|
| 11 |
+
* @returns A function that maps a readonly array to an object keyed by the derived keys.
|
| 12 |
+
*
|
| 13 |
+
* @example
|
| 14 |
+
* import { keyBy, pipe } from 'es-toolkit/fp';
|
| 15 |
+
*
|
| 16 |
+
* pipe([{ id: 'a', value: 1 }, { id: 'b', value: 2 }], keyBy(item => item.id));
|
| 17 |
+
* // => { a: { id: 'a', value: 1 }, b: { id: 'b', value: 2 } }
|
| 18 |
+
*/
|
| 19 |
+
declare function keyBy<T, K extends PropertyKey>(getKey: (item: T, index: number, array: readonly T[]) => K): (array: readonly T[]) => Record<K, T>;
|
| 20 |
+
//#endregion
|
| 21 |
+
export { keyBy };
|
node_modules/es-toolkit/dist/fp/array/keyBy.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const require_keyBy = require("../../array/keyBy.js");
|
| 2 |
+
//#region src/fp/array/keyBy.ts
|
| 3 |
+
/**
|
| 4 |
+
* Creates a function that indexes values by a derived key.
|
| 5 |
+
*
|
| 6 |
+
* The key selector receives each value, index, and full input array. When multiple values
|
| 7 |
+
* produce the same key, the last value wins, matching the main {@link keyBy} behavior.
|
| 8 |
+
*
|
| 9 |
+
* @template T - The type of elements in the array.
|
| 10 |
+
* @template K - The property-key type produced by the selector.
|
| 11 |
+
* @param getKey - Called with each value, index, and array to produce an object key.
|
| 12 |
+
* @returns A function that maps a readonly array to an object keyed by the derived keys.
|
| 13 |
+
*
|
| 14 |
+
* @example
|
| 15 |
+
* import { keyBy, pipe } from 'es-toolkit/fp';
|
| 16 |
+
*
|
| 17 |
+
* pipe([{ id: 'a', value: 1 }, { id: 'b', value: 2 }], keyBy(item => item.id));
|
| 18 |
+
* // => { a: { id: 'a', value: 1 }, b: { id: 'b', value: 2 } }
|
| 19 |
+
*/
|
| 20 |
+
function keyBy(getKey) {
|
| 21 |
+
return function(array) {
|
| 22 |
+
return require_keyBy.keyBy(array, getKey);
|
| 23 |
+
};
|
| 24 |
+
}
|
| 25 |
+
//#endregion
|
| 26 |
+
exports.keyBy = keyBy;
|
node_modules/es-toolkit/dist/fp/array/keyBy.mjs
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { keyBy as keyBy$1 } from "../../array/keyBy.mjs";
|
| 2 |
+
//#region src/fp/array/keyBy.ts
|
| 3 |
+
/**
|
| 4 |
+
* Creates a function that indexes values by a derived key.
|
| 5 |
+
*
|
| 6 |
+
* The key selector receives each value, index, and full input array. When multiple values
|
| 7 |
+
* produce the same key, the last value wins, matching the main {@link keyBy} behavior.
|
| 8 |
+
*
|
| 9 |
+
* @template T - The type of elements in the array.
|
| 10 |
+
* @template K - The property-key type produced by the selector.
|
| 11 |
+
* @param getKey - Called with each value, index, and array to produce an object key.
|
| 12 |
+
* @returns A function that maps a readonly array to an object keyed by the derived keys.
|
| 13 |
+
*
|
| 14 |
+
* @example
|
| 15 |
+
* import { keyBy, pipe } from 'es-toolkit/fp';
|
| 16 |
+
*
|
| 17 |
+
* pipe([{ id: 'a', value: 1 }, { id: 'b', value: 2 }], keyBy(item => item.id));
|
| 18 |
+
* // => { a: { id: 'a', value: 1 }, b: { id: 'b', value: 2 } }
|
| 19 |
+
*/
|
| 20 |
+
function keyBy(getKey) {
|
| 21 |
+
return function(array) {
|
| 22 |
+
return keyBy$1(array, getKey);
|
| 23 |
+
};
|
| 24 |
+
}
|
| 25 |
+
//#endregion
|
| 26 |
+
export { keyBy };
|
node_modules/es-toolkit/dist/fp/array/last.d.mts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/fp/array/last.d.ts
|
| 2 |
+
/**
|
| 3 |
+
* Creates a function that returns the last element of a non-empty array.
|
| 4 |
+
*
|
| 5 |
+
* This overload preserves the non-empty tuple guarantee: the returned function
|
| 6 |
+
* always returns T when the piped array has at least one element.
|
| 7 |
+
*
|
| 8 |
+
* @template T - The type of elements in the array.
|
| 9 |
+
* @returns A function that maps a non-empty readonly array to its last element.
|
| 10 |
+
*
|
| 11 |
+
* @example
|
| 12 |
+
* import { last, pipe } from 'es-toolkit/fp';
|
| 13 |
+
*
|
| 14 |
+
* pipe([1, 2, 3] as const, last());
|
| 15 |
+
* // => 3
|
| 16 |
+
*/
|
| 17 |
+
declare function last<T>(): (array: readonly [...T[], T]) => T;
|
| 18 |
+
/**
|
| 19 |
+
* Creates a function that returns the last element of an array, or undefined.
|
| 20 |
+
*
|
| 21 |
+
* Empty arrays return undefined, matching the main {@link last} behavior. Use
|
| 22 |
+
* the returned function with {@link pipe}.
|
| 23 |
+
*
|
| 24 |
+
* @template T - The type of elements in the array.
|
| 25 |
+
* @returns A function that maps a readonly array to its last element, or undefined.
|
| 26 |
+
*
|
| 27 |
+
* @example
|
| 28 |
+
* import { last, pipe } from 'es-toolkit/fp';
|
| 29 |
+
*
|
| 30 |
+
* pipe([] as number[], last());
|
| 31 |
+
* // => undefined
|
| 32 |
+
*/
|
| 33 |
+
declare function last<T>(): (array: readonly T[]) => T | undefined;
|
| 34 |
+
//#endregion
|
| 35 |
+
export { last };
|
node_modules/es-toolkit/dist/fp/array/last.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/fp/array/last.d.ts
|
| 2 |
+
/**
|
| 3 |
+
* Creates a function that returns the last element of a non-empty array.
|
| 4 |
+
*
|
| 5 |
+
* This overload preserves the non-empty tuple guarantee: the returned function
|
| 6 |
+
* always returns T when the piped array has at least one element.
|
| 7 |
+
*
|
| 8 |
+
* @template T - The type of elements in the array.
|
| 9 |
+
* @returns A function that maps a non-empty readonly array to its last element.
|
| 10 |
+
*
|
| 11 |
+
* @example
|
| 12 |
+
* import { last, pipe } from 'es-toolkit/fp';
|
| 13 |
+
*
|
| 14 |
+
* pipe([1, 2, 3] as const, last());
|
| 15 |
+
* // => 3
|
| 16 |
+
*/
|
| 17 |
+
declare function last<T>(): (array: readonly [...T[], T]) => T;
|
| 18 |
+
/**
|
| 19 |
+
* Creates a function that returns the last element of an array, or undefined.
|
| 20 |
+
*
|
| 21 |
+
* Empty arrays return undefined, matching the main {@link last} behavior. Use
|
| 22 |
+
* the returned function with {@link pipe}.
|
| 23 |
+
*
|
| 24 |
+
* @template T - The type of elements in the array.
|
| 25 |
+
* @returns A function that maps a readonly array to its last element, or undefined.
|
| 26 |
+
*
|
| 27 |
+
* @example
|
| 28 |
+
* import { last, pipe } from 'es-toolkit/fp';
|
| 29 |
+
*
|
| 30 |
+
* pipe([] as number[], last());
|
| 31 |
+
* // => undefined
|
| 32 |
+
*/
|
| 33 |
+
declare function last<T>(): (array: readonly T[]) => T | undefined;
|
| 34 |
+
//#endregion
|
| 35 |
+
export { last };
|
node_modules/es-toolkit/dist/fp/array/last.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const require_last = require("../../array/last.js");
|
| 2 |
+
//#region src/fp/array/last.ts
|
| 3 |
+
function last() {
|
| 4 |
+
return function(array) {
|
| 5 |
+
return require_last.last(array);
|
| 6 |
+
};
|
| 7 |
+
}
|
| 8 |
+
//#endregion
|
| 9 |
+
exports.last = last;
|
node_modules/es-toolkit/dist/fp/array/last.mjs
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { last as last$1 } from "../../array/last.mjs";
|
| 2 |
+
//#region src/fp/array/last.ts
|
| 3 |
+
function last() {
|
| 4 |
+
return function(array) {
|
| 5 |
+
return last$1(array);
|
| 6 |
+
};
|
| 7 |
+
}
|
| 8 |
+
//#endregion
|
| 9 |
+
export { last };
|
node_modules/es-toolkit/dist/fp/array/length.d.mts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/fp/array/length.d.ts
|
| 2 |
+
/**
|
| 3 |
+
* Creates a function that returns the length of an array.
|
| 4 |
+
*
|
| 5 |
+
* Use it with {@link pipe} when a pipeline should end with the number of input values.
|
| 6 |
+
*
|
| 7 |
+
* @template T - The type of elements in the array.
|
| 8 |
+
* @returns A function that maps a readonly array to its length.
|
| 9 |
+
*
|
| 10 |
+
* @example
|
| 11 |
+
* import { length, pipe } from 'es-toolkit/fp';
|
| 12 |
+
*
|
| 13 |
+
* pipe(['a', 'b', 'c'], length());
|
| 14 |
+
* // => 3
|
| 15 |
+
*/
|
| 16 |
+
declare function length<T>(): (array: readonly T[]) => number;
|
| 17 |
+
//#endregion
|
| 18 |
+
export { length };
|
node_modules/es-toolkit/dist/fp/array/length.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/fp/array/length.d.ts
|
| 2 |
+
/**
|
| 3 |
+
* Creates a function that returns the length of an array.
|
| 4 |
+
*
|
| 5 |
+
* Use it with {@link pipe} when a pipeline should end with the number of input values.
|
| 6 |
+
*
|
| 7 |
+
* @template T - The type of elements in the array.
|
| 8 |
+
* @returns A function that maps a readonly array to its length.
|
| 9 |
+
*
|
| 10 |
+
* @example
|
| 11 |
+
* import { length, pipe } from 'es-toolkit/fp';
|
| 12 |
+
*
|
| 13 |
+
* pipe(['a', 'b', 'c'], length());
|
| 14 |
+
* // => 3
|
| 15 |
+
*/
|
| 16 |
+
declare function length<T>(): (array: readonly T[]) => number;
|
| 17 |
+
//#endregion
|
| 18 |
+
export { length };
|
node_modules/es-toolkit/dist/fp/array/length.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/fp/array/length.ts
|
| 2 |
+
/**
|
| 3 |
+
* Creates a function that returns the length of an array.
|
| 4 |
+
*
|
| 5 |
+
* Use it with {@link pipe} when a pipeline should end with the number of input values.
|
| 6 |
+
*
|
| 7 |
+
* @template T - The type of elements in the array.
|
| 8 |
+
* @returns A function that maps a readonly array to its length.
|
| 9 |
+
*
|
| 10 |
+
* @example
|
| 11 |
+
* import { length, pipe } from 'es-toolkit/fp';
|
| 12 |
+
*
|
| 13 |
+
* pipe(['a', 'b', 'c'], length());
|
| 14 |
+
* // => 3
|
| 15 |
+
*/
|
| 16 |
+
function length() {
|
| 17 |
+
return function(array) {
|
| 18 |
+
return array.length;
|
| 19 |
+
};
|
| 20 |
+
}
|
| 21 |
+
//#endregion
|
| 22 |
+
exports.length = length;
|
node_modules/es-toolkit/dist/fp/array/length.mjs
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/fp/array/length.ts
|
| 2 |
+
/**
|
| 3 |
+
* Creates a function that returns the length of an array.
|
| 4 |
+
*
|
| 5 |
+
* Use it with {@link pipe} when a pipeline should end with the number of input values.
|
| 6 |
+
*
|
| 7 |
+
* @template T - The type of elements in the array.
|
| 8 |
+
* @returns A function that maps a readonly array to its length.
|
| 9 |
+
*
|
| 10 |
+
* @example
|
| 11 |
+
* import { length, pipe } from 'es-toolkit/fp';
|
| 12 |
+
*
|
| 13 |
+
* pipe(['a', 'b', 'c'], length());
|
| 14 |
+
* // => 3
|
| 15 |
+
*/
|
| 16 |
+
function length() {
|
| 17 |
+
return function(array) {
|
| 18 |
+
return array.length;
|
| 19 |
+
};
|
| 20 |
+
}
|
| 21 |
+
//#endregion
|
| 22 |
+
export { length };
|
node_modules/es-toolkit/dist/fp/array/map.d.mts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/fp/array/map.d.ts
|
| 2 |
+
/**
|
| 3 |
+
* Creates a function that builds a new array by calling `callback` on every
|
| 4 |
+
* element, equivalent to `Array.prototype.map`. Use it with {@link pipe}.
|
| 5 |
+
*
|
| 6 |
+
* The returned function is **lazy-capable**: inside a {@link pipe} it is fused
|
| 7 |
+
* with adjacent lazy functions and runs element-by-element, so a trailing
|
| 8 |
+
* `take` can terminate the walk early without mapping the rest of the input.
|
| 9 |
+
*
|
| 10 |
+
* @template T - The type of elements in the input array.
|
| 11 |
+
* @template U - The type of elements in the output array.
|
| 12 |
+
* @param callback - Called with `(value, index)` for each element; its return
|
| 13 |
+
* value becomes the corresponding element of the output array.
|
| 14 |
+
* @returns A function that maps a `readonly T[]` to a new `U[]`.
|
| 15 |
+
*
|
| 16 |
+
* @example
|
| 17 |
+
* import { pipe, map } from 'es-toolkit/fp';
|
| 18 |
+
*
|
| 19 |
+
* pipe([1, 2, 3], map(x => x * 2)); // => [2, 4, 6]
|
| 20 |
+
*
|
| 21 |
+
* @example
|
| 22 |
+
* // The index is available as the second argument.
|
| 23 |
+
* pipe([10, 20, 30], map((value, index) => value + index)); // => [10, 21, 32]
|
| 24 |
+
*/
|
| 25 |
+
declare function map<T, U>(callback: (value: T, index: number) => U): (array: readonly T[]) => U[];
|
| 26 |
+
//#endregion
|
| 27 |
+
export { map };
|
node_modules/es-toolkit/dist/fp/array/map.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/fp/array/map.d.ts
|
| 2 |
+
/**
|
| 3 |
+
* Creates a function that builds a new array by calling `callback` on every
|
| 4 |
+
* element, equivalent to `Array.prototype.map`. Use it with {@link pipe}.
|
| 5 |
+
*
|
| 6 |
+
* The returned function is **lazy-capable**: inside a {@link pipe} it is fused
|
| 7 |
+
* with adjacent lazy functions and runs element-by-element, so a trailing
|
| 8 |
+
* `take` can terminate the walk early without mapping the rest of the input.
|
| 9 |
+
*
|
| 10 |
+
* @template T - The type of elements in the input array.
|
| 11 |
+
* @template U - The type of elements in the output array.
|
| 12 |
+
* @param callback - Called with `(value, index)` for each element; its return
|
| 13 |
+
* value becomes the corresponding element of the output array.
|
| 14 |
+
* @returns A function that maps a `readonly T[]` to a new `U[]`.
|
| 15 |
+
*
|
| 16 |
+
* @example
|
| 17 |
+
* import { pipe, map } from 'es-toolkit/fp';
|
| 18 |
+
*
|
| 19 |
+
* pipe([1, 2, 3], map(x => x * 2)); // => [2, 4, 6]
|
| 20 |
+
*
|
| 21 |
+
* @example
|
| 22 |
+
* // The index is available as the second argument.
|
| 23 |
+
* pipe([10, 20, 30], map((value, index) => value + index)); // => [10, 21, 32]
|
| 24 |
+
*/
|
| 25 |
+
declare function map<T, U>(callback: (value: T, index: number) => U): (array: readonly T[]) => U[];
|
| 26 |
+
//#endregion
|
| 27 |
+
export { map };
|
node_modules/es-toolkit/dist/fp/array/map.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const require_lazy = require("../_internal/lazy.js");
|
| 2 |
+
//#region src/fp/array/map.ts
|
| 3 |
+
/**
|
| 4 |
+
* Creates a function that builds a new array by calling `callback` on every
|
| 5 |
+
* element, equivalent to `Array.prototype.map`. Use it with {@link pipe}.
|
| 6 |
+
*
|
| 7 |
+
* The returned function is **lazy-capable**: inside a {@link pipe} it is fused
|
| 8 |
+
* with adjacent lazy functions and runs element-by-element, so a trailing
|
| 9 |
+
* `take` can terminate the walk early without mapping the rest of the input.
|
| 10 |
+
*
|
| 11 |
+
* @template T - The type of elements in the input array.
|
| 12 |
+
* @template U - The type of elements in the output array.
|
| 13 |
+
* @param callback - Called with `(value, index)` for each element; its return
|
| 14 |
+
* value becomes the corresponding element of the output array.
|
| 15 |
+
* @returns A function that maps a `readonly T[]` to a new `U[]`.
|
| 16 |
+
*
|
| 17 |
+
* @example
|
| 18 |
+
* import { pipe, map } from 'es-toolkit/fp';
|
| 19 |
+
*
|
| 20 |
+
* pipe([1, 2, 3], map(x => x * 2)); // => [2, 4, 6]
|
| 21 |
+
*
|
| 22 |
+
* @example
|
| 23 |
+
* // The index is available as the second argument.
|
| 24 |
+
* pipe([10, 20, 30], map((value, index) => value + index)); // => [10, 21, 32]
|
| 25 |
+
*/
|
| 26 |
+
function map(callback) {
|
| 27 |
+
function mapEager(array) {
|
| 28 |
+
return array.map(callback);
|
| 29 |
+
}
|
| 30 |
+
const mapLazy = require_lazy.createLazyFunction((value, index, emit) => {
|
| 31 |
+
emit(callback(value, index));
|
| 32 |
+
});
|
| 33 |
+
return require_lazy.combineEagerAndLazyFunctions(mapEager, mapLazy);
|
| 34 |
+
}
|
| 35 |
+
//#endregion
|
| 36 |
+
exports.map = map;
|
node_modules/es-toolkit/dist/fp/array/map.mjs
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { combineEagerAndLazyFunctions, createLazyFunction } from "../_internal/lazy.mjs";
|
| 2 |
+
//#region src/fp/array/map.ts
|
| 3 |
+
/**
|
| 4 |
+
* Creates a function that builds a new array by calling `callback` on every
|
| 5 |
+
* element, equivalent to `Array.prototype.map`. Use it with {@link pipe}.
|
| 6 |
+
*
|
| 7 |
+
* The returned function is **lazy-capable**: inside a {@link pipe} it is fused
|
| 8 |
+
* with adjacent lazy functions and runs element-by-element, so a trailing
|
| 9 |
+
* `take` can terminate the walk early without mapping the rest of the input.
|
| 10 |
+
*
|
| 11 |
+
* @template T - The type of elements in the input array.
|
| 12 |
+
* @template U - The type of elements in the output array.
|
| 13 |
+
* @param callback - Called with `(value, index)` for each element; its return
|
| 14 |
+
* value becomes the corresponding element of the output array.
|
| 15 |
+
* @returns A function that maps a `readonly T[]` to a new `U[]`.
|
| 16 |
+
*
|
| 17 |
+
* @example
|
| 18 |
+
* import { pipe, map } from 'es-toolkit/fp';
|
| 19 |
+
*
|
| 20 |
+
* pipe([1, 2, 3], map(x => x * 2)); // => [2, 4, 6]
|
| 21 |
+
*
|
| 22 |
+
* @example
|
| 23 |
+
* // The index is available as the second argument.
|
| 24 |
+
* pipe([10, 20, 30], map((value, index) => value + index)); // => [10, 21, 32]
|
| 25 |
+
*/
|
| 26 |
+
function map(callback) {
|
| 27 |
+
function mapEager(array) {
|
| 28 |
+
return array.map(callback);
|
| 29 |
+
}
|
| 30 |
+
return combineEagerAndLazyFunctions(mapEager, createLazyFunction((value, index, emit) => {
|
| 31 |
+
emit(callback(value, index));
|
| 32 |
+
}));
|
| 33 |
+
}
|
| 34 |
+
//#endregion
|
| 35 |
+
export { map };
|