es-toolkit 1.48.1-dev.1882 → 1.48.1-dev.1884
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.
|
@@ -6,9 +6,8 @@
|
|
|
6
6
|
* of elements removed from the start.
|
|
7
7
|
*
|
|
8
8
|
* @template T - The type of elements in the array.
|
|
9
|
-
* @param
|
|
9
|
+
* @param array - The array from which to drop elements.
|
|
10
10
|
* @param itemsCount - The number of elements to drop from the beginning of the array.
|
|
11
|
-
* @param [guard] - Enables use as an iteratee for methods like `_.map`.
|
|
12
11
|
* @returns A new array with the specified number of elements removed from the start.
|
|
13
12
|
*
|
|
14
13
|
* @example
|
|
@@ -16,6 +15,6 @@
|
|
|
16
15
|
* const result = drop(array, 2);
|
|
17
16
|
* result will be [3, 4, 5] since the first two elements are dropped.
|
|
18
17
|
*/
|
|
19
|
-
declare function drop<T>(array: ArrayLike<T> | null | undefined,
|
|
18
|
+
declare function drop<T>(array: ArrayLike<T> | null | undefined, itemsCount?: number): T[];
|
|
20
19
|
//#endregion
|
|
21
20
|
export { drop };
|
|
@@ -6,9 +6,8 @@
|
|
|
6
6
|
* of elements removed from the start.
|
|
7
7
|
*
|
|
8
8
|
* @template T - The type of elements in the array.
|
|
9
|
-
* @param
|
|
9
|
+
* @param array - The array from which to drop elements.
|
|
10
10
|
* @param itemsCount - The number of elements to drop from the beginning of the array.
|
|
11
|
-
* @param [guard] - Enables use as an iteratee for methods like `_.map`.
|
|
12
11
|
* @returns A new array with the specified number of elements removed from the start.
|
|
13
12
|
*
|
|
14
13
|
* @example
|
|
@@ -16,6 +15,6 @@
|
|
|
16
15
|
* const result = drop(array, 2);
|
|
17
16
|
* result will be [3, 4, 5] since the first two elements are dropped.
|
|
18
17
|
*/
|
|
19
|
-
declare function drop<T>(array: ArrayLike<T> | null | undefined,
|
|
18
|
+
declare function drop<T>(array: ArrayLike<T> | null | undefined, itemsCount?: number): T[];
|
|
20
19
|
//#endregion
|
|
21
20
|
export { drop };
|
|
@@ -3,10 +3,10 @@ const require_toInteger = require("../util/toInteger.js");
|
|
|
3
3
|
const require_toArray = require("../_internal/toArray.js");
|
|
4
4
|
const require_isArrayLike = require("../predicate/isArrayLike.js");
|
|
5
5
|
//#region src/compat/array/drop.ts
|
|
6
|
-
function drop(
|
|
7
|
-
if (!require_isArrayLike.isArrayLike(
|
|
6
|
+
function drop(array, itemsCount = 1, guard) {
|
|
7
|
+
if (!require_isArrayLike.isArrayLike(array)) return [];
|
|
8
8
|
itemsCount = guard ? 1 : require_toInteger.toInteger(itemsCount);
|
|
9
|
-
return require_drop.drop(require_toArray.toArray(
|
|
9
|
+
return require_drop.drop(require_toArray.toArray(array), itemsCount);
|
|
10
10
|
}
|
|
11
11
|
//#endregion
|
|
12
12
|
exports.drop = drop;
|
|
@@ -3,10 +3,10 @@ import { toInteger } from "../util/toInteger.mjs";
|
|
|
3
3
|
import { toArray } from "../_internal/toArray.mjs";
|
|
4
4
|
import { isArrayLike } from "../predicate/isArrayLike.mjs";
|
|
5
5
|
//#region src/compat/array/drop.ts
|
|
6
|
-
function drop(
|
|
7
|
-
if (!isArrayLike(
|
|
6
|
+
function drop(array, itemsCount = 1, guard) {
|
|
7
|
+
if (!isArrayLike(array)) return [];
|
|
8
8
|
itemsCount = guard ? 1 : toInteger(itemsCount);
|
|
9
|
-
return drop$1(toArray(
|
|
9
|
+
return drop$1(toArray(array), itemsCount);
|
|
10
10
|
}
|
|
11
11
|
//#endregion
|
|
12
12
|
export { drop };
|
|
@@ -31,7 +31,7 @@ import { ListIteratee } from "../_internal/ListIteratee.mjs";
|
|
|
31
31
|
*
|
|
32
32
|
* // Using property shorthand
|
|
33
33
|
* dropRightWhile(users, 'active');
|
|
34
|
-
* // => [{ user: 'barney', active: true }]
|
|
34
|
+
* // => [{ user: 'barney', active: true }, { user: 'fred', active: false }, { user: 'pebbles', active: false }]
|
|
35
35
|
*/
|
|
36
36
|
declare function dropRightWhile<T>(array: ArrayLike<T> | null | undefined, predicate?: ListIteratee<T>): T[];
|
|
37
37
|
//#endregion
|
|
@@ -31,7 +31,7 @@ import { ListIteratee } from "../_internal/ListIteratee.js";
|
|
|
31
31
|
*
|
|
32
32
|
* // Using property shorthand
|
|
33
33
|
* dropRightWhile(users, 'active');
|
|
34
|
-
* // => [{ user: 'barney', active: true }]
|
|
34
|
+
* // => [{ user: 'barney', active: true }, { user: 'fred', active: false }, { user: 'pebbles', active: false }]
|
|
35
35
|
*/
|
|
36
36
|
declare function dropRightWhile<T>(array: ArrayLike<T> | null | undefined, predicate?: ListIteratee<T>): T[];
|
|
37
37
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "es-toolkit",
|
|
3
|
-
"version": "1.48.1-dev.
|
|
3
|
+
"version": "1.48.1-dev.1884+f983dc6c",
|
|
4
4
|
"description": "A state-of-the-art, high-performance JavaScript utility library with a small bundle size and strong type annotations.",
|
|
5
5
|
"homepage": "https://es-toolkit.dev",
|
|
6
6
|
"bugs": "https://github.com/toss/es-toolkit/issues",
|