UNPKG

@newdash/newdash

Version:

javascript/typescript utility library

28 lines (27 loc) 765 B
/** * Removes elements from `array` corresponding to `indexes` and returns an * array of removed elements. * * **Note:** Unlike `at`, this method mutates `array`. * * @since 5.11.0 * @category Array * @param array The array to modify. * @param indexes The indexes of elements to remove. * @returns Returns the new array of removed elements. * @see [[pull]], [[pullAll]], [[pullAllBy]], [[pullAllWith]], [[remove]], [[reject]] * @example * * ```js * const array = ['a', 'b', 'c', 'd'] * const pulled = pullAt(array, [1, 3]) * * console.log(array) * // => ['a', 'c'] * * console.log(pulled) * // => ['b', 'd'] * ``` */ export declare function pullAt<T = any>(array: Array<T>, ...indexes: (number | string)[]): Array<T>; export default pullAt;