Détail du package

remove-array-items

mreinstein352.4kMIT3.0.0

remove items from a javascript array without generating memory garbage

array, splice, remove, nogarbage

readme

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 ]

changelog

3.0.0

  • BREAKING: move to a pure es module, drop commonjs and the build step
  • simplify usage instructions
  • update tap and tests to use esm
  • remove node 6-11 from travis tests

2.0.0

  • remove node 4, 5 from travis tests
  • move source code into src/ and convert to es6
  • remove unneeded 'use strict'

1.1.0

  • support es6 modules in rollup and webpack via package.json module field
  • update deps
  • update travis config

1.0.0

  • initial commit