1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 09:49:28 +02:00
Oinktube/node_modules/unordered-array-remove
2023-02-17 15:04:26 -03:00
..
.npmignore Updates node modules 2023-02-17 15:04:26 -03:00
.travis.yml Updates node modules 2023-02-17 15:04:26 -03:00
index.js Updates node modules 2023-02-17 15:04:26 -03:00
LICENSE Updates node modules 2023-02-17 15:04:26 -03:00
package.json Updates node modules 2023-02-17 15:04:26 -03:00
README.md Updates node modules 2023-02-17 15:04:26 -03:00
test.js Updates node modules 2023-02-17 15:04:26 -03:00

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