array-remove-item

0.1.2 • Public • Published

remove item from array

XO code style

Just a simple function to remove an item from an Array. Works well in both, the browser & node.

install

npm i -S array-remove-item

and use it

import removeItemFromArray from 'array-remove-item'
// OR
const removeItemFromArray = require('array-remove-item')

const abcde = removeItemFromArray(['a', 'b', 'b', 'c', 'd', 'e'], 1)
console.log(abcde) // ['a', 'b', 'c', 'd', 'e']

behavior

  • removeItemFromArray is a pure function, it does not mutate the provided array.
  • returns the same array if
    • the position provided is not a number.
    • no position is provided
    • the position is out of the range of the array (grater than arr.length or less than 0)

FAQ

Readme

Keywords

Package Sidebar

Install

npm i array-remove-item

Weekly Downloads

2

Version

0.1.2

License

MIT

Last publish

Collaborators

  • gillchristian