es-toolkit 1.10.1-dev.257 → 1.10.1-dev.258
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/drop.js +2 -1
- package/dist/array/drop.js.map +1 -1
- package/dist/array/drop.mjs +1 -1
- package/dist/array/dropRight.js +3 -3
- package/dist/array/dropRight.js.map +1 -1
- package/dist/array/dropRight.mjs +1 -1
- package/dist/array/index.js +5 -4
- package/dist/array/index.js.map +1 -1
- package/dist/array/index.mjs +33 -33
- package/dist/chunk-3EZAFZG3.mjs +10 -0
- package/dist/{chunk-TF3J4M5O.mjs.map → chunk-3EZAFZG3.mjs.map} +1 -1
- package/dist/chunk-OXZCMC5I.mjs +13 -0
- package/dist/{chunk-WRSDEUO4.mjs.map → chunk-OXZCMC5I.mjs.map} +1 -1
- package/dist/compat/index.js +5 -4
- package/dist/compat/index.js.map +1 -1
- package/dist/compat/index.mjs +54 -54
- package/dist/function/index.mjs +6 -6
- package/dist/index.js +5 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +54 -54
- package/package.json +1 -1
- package/dist/chunk-TF3J4M5O.mjs +0 -9
- package/dist/chunk-WRSDEUO4.mjs +0 -13
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/array/drop.ts"],"sourcesContent":["/**\n * Removes a specified number of elements from the beginning of an array and returns the rest.\n *\n * This function takes an array and a number, and returns a new array with the specified number\n * of elements removed from the start.\n *\n * @template T - The type of elements in the array.\n * @param {T[]} arr - The array from which to drop elements.\n * @param {number} itemsCount - The number of elements to drop from the beginning of the array.\n * @returns {T[]} A new array with the specified number of elements removed from the start.\n *\n * @example\n * const array = [1, 2, 3, 4, 5];\n * const result = drop(array, 2);\n * // result will be [3, 4, 5] since the first two elements are dropped.\n */\nexport function drop<T>(arr: readonly T[], itemsCount: number): T[] {\n
|
|
1
|
+
{"version":3,"sources":["../src/array/drop.ts"],"sourcesContent":["/**\n * Removes a specified number of elements from the beginning of an array and returns the rest.\n *\n * This function takes an array and a number, and returns a new array with the specified number\n * of elements removed from the start.\n *\n * @template T - The type of elements in the array.\n * @param {T[]} arr - The array from which to drop elements.\n * @param {number} itemsCount - The number of elements to drop from the beginning of the array.\n * @returns {T[]} A new array with the specified number of elements removed from the start.\n *\n * @example\n * const array = [1, 2, 3, 4, 5];\n * const result = drop(array, 2);\n * // result will be [3, 4, 5] since the first two elements are dropped.\n */\nexport function drop<T>(arr: readonly T[], itemsCount: number): T[] {\n itemsCount = Math.max(itemsCount, 0);\n\n return arr.slice(itemsCount);\n}\n"],"mappings":";AAgBO,SAAS,KAAQ,KAAmB,YAAyB;AAClE,eAAa,KAAK,IAAI,YAAY,CAAC;AAEnC,SAAO,IAAI,MAAM,UAAU;AAC7B;","names":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// src/array/dropRight.ts
|
|
2
|
+
function dropRight(arr, itemsCount) {
|
|
3
|
+
itemsCount = Math.min(-itemsCount, 0);
|
|
4
|
+
if (itemsCount === 0) {
|
|
5
|
+
return arr.slice();
|
|
6
|
+
}
|
|
7
|
+
return arr.slice(0, itemsCount);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export {
|
|
11
|
+
dropRight
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=chunk-OXZCMC5I.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/array/dropRight.ts"],"sourcesContent":["/**\n * Removes a specified number of elements from the end of an array and returns the rest.\n *\n * This function takes an array and a number, and returns a new array with the specified number\n * of elements removed from the end.\n *\n * @template T - The type of elements in the array.\n * @param {T[]} arr - The array from which to drop elements.\n * @param {number} itemsCount - The number of elements to drop from the end of the array.\n * @returns {T[]} A new array with the specified number of elements removed from the end.\n *\n * @example\n * const array = [1, 2, 3, 4, 5];\n * const result = dropRight(array, 2);\n * // result will be [1, 2, 3] since the last two elements are dropped.\n */\nexport function dropRight<T>(arr: readonly T[], itemsCount: number): T[] {\n
|
|
1
|
+
{"version":3,"sources":["../src/array/dropRight.ts"],"sourcesContent":["/**\n * Removes a specified number of elements from the end of an array and returns the rest.\n *\n * This function takes an array and a number, and returns a new array with the specified number\n * of elements removed from the end.\n *\n * @template T - The type of elements in the array.\n * @param {T[]} arr - The array from which to drop elements.\n * @param {number} itemsCount - The number of elements to drop from the end of the array.\n * @returns {T[]} A new array with the specified number of elements removed from the end.\n *\n * @example\n * const array = [1, 2, 3, 4, 5];\n * const result = dropRight(array, 2);\n * // result will be [1, 2, 3] since the last two elements are dropped.\n */\nexport function dropRight<T>(arr: readonly T[], itemsCount: number): T[] {\n itemsCount = Math.min(-itemsCount, 0);\n\n if (itemsCount === 0) {\n return arr.slice();\n }\n\n return arr.slice(0, itemsCount);\n}\n"],"mappings":";AAgBO,SAAS,UAAa,KAAmB,YAAyB;AACvE,eAAa,KAAK,IAAI,CAAC,YAAY,CAAC;AAEpC,MAAI,eAAe,GAAG;AACpB,WAAO,IAAI,MAAM;AAAA,EACnB;AAEA,SAAO,IAAI,MAAM,GAAG,UAAU;AAChC;","names":[]}
|
package/dist/compat/index.js
CHANGED
|
@@ -211,16 +211,17 @@ function differenceWith(firstArr, secondArr, areItemsEqual) {
|
|
|
211
211
|
|
|
212
212
|
// src/array/drop.ts
|
|
213
213
|
function drop(arr, itemsCount) {
|
|
214
|
-
|
|
214
|
+
itemsCount = Math.max(itemsCount, 0);
|
|
215
|
+
return arr.slice(itemsCount);
|
|
215
216
|
}
|
|
216
217
|
|
|
217
218
|
// src/array/dropRight.ts
|
|
218
219
|
function dropRight(arr, itemsCount) {
|
|
219
|
-
|
|
220
|
-
if (
|
|
220
|
+
itemsCount = Math.min(-itemsCount, 0);
|
|
221
|
+
if (itemsCount === 0) {
|
|
221
222
|
return arr.slice();
|
|
222
223
|
}
|
|
223
|
-
return arr.slice(0,
|
|
224
|
+
return arr.slice(0, itemsCount);
|
|
224
225
|
}
|
|
225
226
|
|
|
226
227
|
// src/array/dropRightWhile.ts
|