JSPM

unordered-array-remove

1.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 39921
  • Score
    100M100P100Q156595F
  • License MIT

Efficiently remove an element from an unordered array without doing a splice

Package Exports

  • unordered-array-remove

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (unordered-array-remove) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

unordered-array-remove

Efficiently remove an element from an unordered array without doing a splice

npm install unordered-array-remove

build status

Usage

var remove = require('unordered-array-remove')

var list = ['a', 'b', 'c', 'd', 'e']
remove(list, 2) // remove 'c'
console.log(list) // returns ['a', 'b', 'e', 'd'] (no 'c')

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.

License

MIT