remove-array-items
remove items from a javascript array without generating memory garbage
Last updated 7 years ago by mreinstein .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install remove-array-items 
SYNC missed versions from official npm registry.

remove-array-items

remove items from a javascript array without generating memory garbage.

Build Status

Despite there being a number of "remove array items" in npm, I couldn't find satisfying all criteria:

  • doesn't generate garbage
  • performs similar or better to the native array.splice
  • has tests
  • is a pure es module

so here we are.

originally inspired by https://gamealchemist.wordpress.com/2013/05/01/lets-get-those-javascript-arrays-to-work-fast/

(which is a gold mine for performant, non-garbage generating array operations by the way.)

usage

import removeItems from 'remove-array-items'


const arr = [ 1, 2, 3, 4, 5, 6, 7, 8, 9 ]

const startIdx = 3    // integer >= 0
const removeCount = 4 // int >= 0

removeItems(arr, startIdx, removeCount)  // after running, arr === [ 1, 2, 3, 8, 9 ]

Current Tags

  • 3.0.0                                ...           latest (5 years ago)

7 Versions

  • 3.0.0                                ...           5 years ago
  • 2.0.1                                ...           6 years ago
  • 2.0.0                                ...           7 years ago
  • 1.1.1                                ...           7 years ago
  • 1.1.0                                ...           7 years ago
  • 1.0.0                                ...           9 years ago
  • 0.0.1                                ...           9 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (0)
None
Dev Dependencies (1)

Copyright 2013 - present © cnpmjs.org | Home |