remove-array-items

WebJar for remove-array-items

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

remove-array-items
Last Version

Last Version

1.1.1
Release Date

Release Date

Type

Type

jar
Description

Description

remove-array-items
WebJar for remove-array-items
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/mreinstein/remove-array-items

Download remove-array-items

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/remove-array-items/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>remove-array-items</artifactId>
    <version>1.1.1</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/remove-array-items/
implementation 'org.webjars.npm:remove-array-items:1.1.1'
// https://jarcasting.com/artifacts/org.webjars.npm/remove-array-items/
implementation ("org.webjars.npm:remove-array-items:1.1.1")
'org.webjars.npm:remove-array-items:jar:1.1.1'
<dependency org="org.webjars.npm" name="remove-array-items" rev="1.1.1">
  <artifact name="remove-array-items" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='remove-array-items', version='1.1.1')
)
libraryDependencies += "org.webjars.npm" % "remove-array-items" % "1.1.1"
[org.webjars.npm/remove-array-items "1.1.1"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

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)

startIdx is an integer >= 0, and removeCount is an integer > 0.

example usage

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

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

Versions

Version
1.1.1
1.0.0