Socket
Socket
Sign inDemoInstall

remove-array-items

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

remove-array-items

remove items from a javascript array without generating memory garbage


Version published
Weekly downloads
51K
decreased by-14.6%
Maintainers
1
Weekly downloads
 
Created
Source

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
  • es3+ compatible
  • works in both commonjs (node) and es modules (import)

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.)

api

removeItems(arr, startIdx, removeCount)

commonjs usage

const removeItems = require('remove-array-items')

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

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

es module usage

import removeItems from 'remove-array-items'

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

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

Keywords

FAQs

Package last updated on 12 Dec 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc