@types/unordered-array-remove
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

Installation

npm install --save @types/unordered-array-remove

Summary

This package contains type definitions for unordered-array-remove (https://github.com/mafintosh/unordered-array-remove).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/unordered-array-remove.

index.d.ts

export = arrayRemove;

/**
 * Efficiently remove an element from an unordered array without doing a splice.
 *
 * This works by popping the last element (which is fast because it doesn't need
 * shift all array elements) and overwriting the removed index with this element.
 *
 * @param array The array to remove the element at index.
 * @param index The index to remove the element at.
 * @returns The removed element or `undefined` in case the index was out of bounds.
 *
 * @example
 * import remove = require('unordered-array-remove');
 *
 * const list = ['a', 'b', 'c', 'd', 'e'];
 * remove(list, 2); // remove 'c'
 * console.log(list); // returns ['a', 'b', 'e', 'd'] (no 'c')
 */
declare function arrayRemove<T>(array: T[], index: number): T | undefined;

Additional Details

  • Last updated: Tue, 07 Nov 2023 15:11:36 GMT
  • Dependencies: none

Credits

These definitions were written by BendingBender.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/unordered-array-remove

Weekly Downloads

44

Version

1.0.2

License

MIT

Unpacked Size

4.19 kB

Total Files

5

Last publish

Collaborators

  • types