source: node_modules/es-toolkit/dist/compat/array/pullAt.d.ts

Last change on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago

Added visualizations

  • Property mode set to 100644
File size: 1.7 KB
RevLine 
[a762898]1import { Many } from '../_internal/Many.js';
2import { MutableList } from '../_internal/MutableList.d.js';
3import { RejectReadonly } from '../_internal/RejectReadonly.d.js';
4
5/**
6 * Removes elements from array corresponding to the given indexes and returns an array of the removed elements.
7 * Indexes may be specified as an array of indexes or as individual arguments.
8 *
9 * **Note:** Unlike `_.at`, this method mutates `array`.
10 *
11 * @template T
12 * @param {T[]} array - The array to modify.
13 * @param {...Array<number | number[]>} indexes - The indexes of elements to remove, specified as individual indexes or arrays of indexes.
14 * @returns {T[]} Returns the new array of removed elements.
15 *
16 * @example
17 * var array = [5, 10, 15, 20];
18 * var evens = pullAt(array, 1, 3);
19 *
20 * console.log(array);
21 * // => [5, 15]
22 *
23 * console.log(evens);
24 * // => [10, 20]
25 */
26declare function pullAt<T>(array: T[], ...indexes: Array<Many<number>>): T[];
27/**
28 * Removes elements from array corresponding to the given indexes and returns an array of the removed elements.
29 * Indexes may be specified as an array of indexes or as individual arguments.
30 *
31 * **Note:** Unlike `_.at`, this method mutates `array`.
32 *
33 * @template L
34 * @param {L} array - The array to modify.
35 * @param {...Array<number | number[]>} indexes - The indexes of elements to remove, specified as individual indexes or arrays of indexes.
36 * @returns {L} Returns the new array of removed elements.
37 *
38 * @example
39 * var array = [5, 10, 15, 20];
40 * var evens = pullAt(array, 1, 3);
41 *
42 * console.log(array);
43 * // => [5, 15]
44 *
45 * console.log(evens);
46 * // => [10, 20]
47 */
48declare function pullAt<L extends MutableList<any>>(array: RejectReadonly<L>, ...indexes: Array<Many<number>>): L;
49
50export { pullAt };
Note: See TracBrowser for help on using the repository browser.