es-toolkit 1.10.1-dev.243 → 1.10.1-dev.244
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/array/fill.d.mts +9 -6
- package/dist/array/fill.d.ts +9 -6
- package/dist/array/fill.js +7 -6
- package/dist/array/fill.js.map +1 -1
- package/dist/array/fill.mjs +1 -1
- package/dist/array/index.js +7 -6
- package/dist/array/index.js.map +1 -1
- package/dist/array/index.mjs +32 -32
- package/dist/chunk-YFN6KOC4.mjs +15 -0
- package/dist/chunk-YFN6KOC4.mjs.map +1 -0
- package/dist/compat/index.js +7 -6
- package/dist/compat/index.js.map +1 -1
- package/dist/compat/index.mjs +56 -56
- package/dist/function/index.mjs +6 -6
- package/dist/index.js +7 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +56 -56
- package/package.json +1 -1
- package/dist/chunk-6KP7CLVJ.mjs +0 -14
- package/dist/chunk-6KP7CLVJ.mjs.map +0 -1
package/dist/array/index.mjs
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import "../chunk-DDH7K4QM.mjs";
|
|
2
|
+
import {
|
|
3
|
+
unzipWith
|
|
4
|
+
} from "../chunk-IFNXROZR.mjs";
|
|
5
|
+
import {
|
|
6
|
+
without
|
|
7
|
+
} from "../chunk-PYEYV7BY.mjs";
|
|
2
8
|
import {
|
|
3
9
|
xor
|
|
4
10
|
} from "../chunk-L7FQX5MN.mjs";
|
|
@@ -17,12 +23,21 @@ import {
|
|
|
17
23
|
import {
|
|
18
24
|
zipWith
|
|
19
25
|
} from "../chunk-4KYXHZ4R.mjs";
|
|
26
|
+
import {
|
|
27
|
+
toFilled
|
|
28
|
+
} from "../chunk-OP4OAKQJ.mjs";
|
|
29
|
+
import {
|
|
30
|
+
union
|
|
31
|
+
} from "../chunk-R6QA7PLZ.mjs";
|
|
20
32
|
import {
|
|
21
33
|
unionBy
|
|
22
34
|
} from "../chunk-NFS7RWWE.mjs";
|
|
23
35
|
import {
|
|
24
36
|
unionWith
|
|
25
37
|
} from "../chunk-2ZCITDMK.mjs";
|
|
38
|
+
import {
|
|
39
|
+
uniq
|
|
40
|
+
} from "../chunk-DVK2N4KC.mjs";
|
|
26
41
|
import {
|
|
27
42
|
uniqBy
|
|
28
43
|
} from "../chunk-OXAZEEGP.mjs";
|
|
@@ -33,11 +48,13 @@ import {
|
|
|
33
48
|
unzip
|
|
34
49
|
} from "../chunk-UYZKMBDO.mjs";
|
|
35
50
|
import {
|
|
36
|
-
|
|
37
|
-
} from "../chunk-
|
|
51
|
+
sample
|
|
52
|
+
} from "../chunk-2KNLZB7V.mjs";
|
|
38
53
|
import {
|
|
39
|
-
|
|
40
|
-
} from "../chunk-
|
|
54
|
+
sampleSize
|
|
55
|
+
} from "../chunk-EHSKB6DF.mjs";
|
|
56
|
+
import "../chunk-GIWAOOFY.mjs";
|
|
57
|
+
import "../chunk-SYWMYQYJ.mjs";
|
|
41
58
|
import {
|
|
42
59
|
shuffle
|
|
43
60
|
} from "../chunk-G7UQ5PUR.mjs";
|
|
@@ -57,14 +74,11 @@ import {
|
|
|
57
74
|
takeWhile
|
|
58
75
|
} from "../chunk-2IXFGSUA.mjs";
|
|
59
76
|
import {
|
|
60
|
-
|
|
61
|
-
} from "../chunk-
|
|
62
|
-
import {
|
|
63
|
-
union
|
|
64
|
-
} from "../chunk-R6QA7PLZ.mjs";
|
|
77
|
+
intersectionBy
|
|
78
|
+
} from "../chunk-O6UXZR3U.mjs";
|
|
65
79
|
import {
|
|
66
|
-
|
|
67
|
-
} from "../chunk-
|
|
80
|
+
intersectionWith
|
|
81
|
+
} from "../chunk-XI7KRD2C.mjs";
|
|
68
82
|
import {
|
|
69
83
|
keyBy
|
|
70
84
|
} from "../chunk-AJKZMN2V.mjs";
|
|
@@ -84,13 +98,8 @@ import {
|
|
|
84
98
|
partition
|
|
85
99
|
} from "../chunk-DN3NOZ3H.mjs";
|
|
86
100
|
import {
|
|
87
|
-
|
|
88
|
-
} from "../chunk-
|
|
89
|
-
import {
|
|
90
|
-
sampleSize
|
|
91
|
-
} from "../chunk-EHSKB6DF.mjs";
|
|
92
|
-
import "../chunk-GIWAOOFY.mjs";
|
|
93
|
-
import "../chunk-SYWMYQYJ.mjs";
|
|
101
|
+
flattenDeep
|
|
102
|
+
} from "../chunk-ML727RRJ.mjs";
|
|
94
103
|
import {
|
|
95
104
|
forEachRight
|
|
96
105
|
} from "../chunk-IEA53J7P.mjs";
|
|
@@ -107,11 +116,11 @@ import {
|
|
|
107
116
|
intersection
|
|
108
117
|
} from "../chunk-FVVSE2F2.mjs";
|
|
109
118
|
import {
|
|
110
|
-
|
|
111
|
-
} from "../chunk-
|
|
119
|
+
differenceBy
|
|
120
|
+
} from "../chunk-LVWX5B43.mjs";
|
|
112
121
|
import {
|
|
113
|
-
|
|
114
|
-
} from "../chunk-
|
|
122
|
+
differenceWith
|
|
123
|
+
} from "../chunk-6NVQAHXP.mjs";
|
|
115
124
|
import {
|
|
116
125
|
drop
|
|
117
126
|
} from "../chunk-S3CORED5.mjs";
|
|
@@ -126,13 +135,10 @@ import {
|
|
|
126
135
|
} from "../chunk-LJ2C6MVP.mjs";
|
|
127
136
|
import {
|
|
128
137
|
fill
|
|
129
|
-
} from "../chunk-
|
|
138
|
+
} from "../chunk-YFN6KOC4.mjs";
|
|
130
139
|
import {
|
|
131
140
|
flatMap
|
|
132
141
|
} from "../chunk-UY76KTPE.mjs";
|
|
133
|
-
import {
|
|
134
|
-
flattenDeep
|
|
135
|
-
} from "../chunk-ML727RRJ.mjs";
|
|
136
142
|
import {
|
|
137
143
|
flatten
|
|
138
144
|
} from "../chunk-33MSBDC6.mjs";
|
|
@@ -148,12 +154,6 @@ import {
|
|
|
148
154
|
import {
|
|
149
155
|
difference
|
|
150
156
|
} from "../chunk-JPUKH67K.mjs";
|
|
151
|
-
import {
|
|
152
|
-
differenceBy
|
|
153
|
-
} from "../chunk-LVWX5B43.mjs";
|
|
154
|
-
import {
|
|
155
|
-
differenceWith
|
|
156
|
-
} from "../chunk-6NVQAHXP.mjs";
|
|
157
157
|
import "../chunk-2MM5EJJX.mjs";
|
|
158
158
|
export {
|
|
159
159
|
chunk,
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// src/array/fill.ts
|
|
2
|
+
function fill(array, value, start = 0, end = array.length) {
|
|
3
|
+
const length = array.length;
|
|
4
|
+
const finalStart = Math.max(start >= 0 ? start : length + start, 0);
|
|
5
|
+
const finalEnd = Math.min(end >= 0 ? end : length + end, length);
|
|
6
|
+
for (let i = finalStart; i < finalEnd; i++) {
|
|
7
|
+
array[i] = value;
|
|
8
|
+
}
|
|
9
|
+
return array;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export {
|
|
13
|
+
fill
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=chunk-YFN6KOC4.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/array/fill.ts"],"sourcesContent":["/**\n * Fills elements of an array with a specified value from the start position up to, but not including, the end position.\n *\n * This function mutates the original array and replaces its elements with the provided value, starting from the specified\n * start index up to the end index (non-inclusive). If the start or end indices are not provided, it defaults to filling the\n * entire array.\n *\n * @param {Array<T | U>} array - The array to fill.\n * @param {U} value - The value to fill the array with.\n * @param {number} [start=0] - The start position. Defaults to 0.\n * @param {number} [end=arr.length] - The end position. Defaults to the array's length.\n * @returns {Array<T | U>} The array with the filled values.\n *\n * @example\n * const array = [1, 2, 3];\n * const result = fill(array, 'a');\n * // => ['a', 'a', 'a']\n *\n * const result = fill(Array(3), 2);\n * // => [2, 2, 2]\n *\n * const result = fill([4, 6, 8, 10], '*', 1, 3);\n * // => [4, '*', '*', 10]\n *\n * const result = fill(array, '*', -2, -1);\n * // => [1, '*', 3]\n */\nexport function fill<T>(array: unknown[], value: T): T[];\nexport function fill<T, U>(array: Array<T | U>, value: U, start: number): Array<T | U>;\nexport function fill<T, U>(array: Array<T | U>, value: U, start: number, end: number): Array<T | U>;\nexport function fill<T, U>(array: Array<T | U>, value: U, start = 0, end = array.length): Array<T | U> {\n const length = array.length;\n const finalStart = Math.max(start >= 0 ? start : length + start, 0);\n const finalEnd = Math.min(end >= 0 ? end : length + end, length);\n\n for (let i = finalStart; i < finalEnd; i++) {\n array[i] = value;\n }\n\n return array;\n}\n"],"mappings":";AA8BO,SAAS,KAAW,OAAqB,OAAU,QAAQ,GAAG,MAAM,MAAM,QAAsB;AACrG,QAAM,SAAS,MAAM;AACrB,QAAM,aAAa,KAAK,IAAI,SAAS,IAAI,QAAQ,SAAS,OAAO,CAAC;AAClE,QAAM,WAAW,KAAK,IAAI,OAAO,IAAI,MAAM,SAAS,KAAK,MAAM;AAE/D,WAAS,IAAI,YAAY,IAAI,UAAU,KAAK;AAC1C,UAAM,CAAC,IAAI;AAAA,EACb;AAEA,SAAO;AACT;","names":[]}
|
package/dist/compat/index.js
CHANGED
|
@@ -214,13 +214,14 @@ function dropWhile(arr, canContinueDropping) {
|
|
|
214
214
|
}
|
|
215
215
|
|
|
216
216
|
// src/array/fill.ts
|
|
217
|
-
function fill(
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
217
|
+
function fill(array, value, start = 0, end = array.length) {
|
|
218
|
+
const length = array.length;
|
|
219
|
+
const finalStart = Math.max(start >= 0 ? start : length + start, 0);
|
|
220
|
+
const finalEnd = Math.min(end >= 0 ? end : length + end, length);
|
|
221
|
+
for (let i = finalStart; i < finalEnd; i++) {
|
|
222
|
+
array[i] = value;
|
|
222
223
|
}
|
|
223
|
-
return
|
|
224
|
+
return array;
|
|
224
225
|
}
|
|
225
226
|
|
|
226
227
|
// src/array/flatten.ts
|