Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

array-remove-item

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

array-remove-item

Remove item from array

  • 0.1.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

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']

NOTE: it requires the rest operator to work. If you are not transpiling your code with Babel's es2015 preset (to work on the browser) or are using a node version older than 5, you will have to use the compiled version: require(array-remove-item/dist/array-remove-item.js).

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

Keywords

FAQs

Package last updated on 24 Jul 2016

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