remove-item-from-array v1.0.4
Remove an Item From an Array
A utility to remove items that match a specified value from an array. Works recursively to remove items from nested arrays.
Install
npm i remove-item-from-array --save
Usage
removeArrayItem(arr, item)
The module exports a function; the first argument is the current array, the second is the value of items that should be removed.
Examples
import removeArrayItem from 'remove-item-from-array'
const arr = removeArrayItem(['cat', 'dog', ['cat', 'goose']], 'cat')
// arr will be ['dog', ['goose']]
You can also pass additional values as arguments to remove multiple items in one statement:
const arr = removeArrayItem(['cat', 'dog', ['goose']], 'cat', 'dog')
// arr will be [['goose']]
Links & Resources
remove-item-from-array on javascriptutils.com
remove-item-from-array on GitHub
remove-item-from-array on Aliyun
remove-item-from-array on TAONPM
remove-item-from-array on jsDlivr
remove-item-from-array on Snyk
remove-item-from-array on Libraries.io
remove-item-from-array on RunKit
remove-item-from-array on npm trends
remove-item-from-array on Package Phobia
remove-item-from-array on Skypack
remove-item-from-array on CNPM
remove-item-from-array on Openbase
remove-item-from-array on githubmemory