remove-array-item
A simple utility to (recursively) remove specified item(s) from an array.
Install
npm i remove-array-item --save
Usage
removeArrayItem(arr, item)
The module simply exports a function; the first argument is the current array, the next is the item that should be removed from all arrays/nested arrays.
It uses a "naive" indexOf
implementation, and so does not do any deep equality checks on objects or the like.
Examples
; const arr = ; // arr will be ['green', ['blue']]
Aditionally, note that additional arguments can be passed (in sequence), and so multiple items can be removed in one statement, a la the following example:
const arr = ; // arr will be [['blue']]