linx-simulator2/node_modules/remove-value
2019-11-22 09:43:37 +00:00
..
index.js Simulator first commit 2019-09-18 11:11:16 +03:00
package.json Added custom log name 2019-11-22 09:43:37 +00:00
README.md Simulator first commit 2019-09-18 11:11:16 +03:00
test.js Simulator first commit 2019-09-18 11:11:16 +03:00

remove-value

Remove one or more elements from an array by value

Installation

// npm
$ npm install remove-value

Usage

var removeValue = require('remove-value');

// as a function
removeValue([ 'apple', 'lemon', 'banana', 'lemon' ], 'lemon'); // [ 'apple', 'banana' ]

removeValue([ 'apple', 'lemon', 'banana', 'lemon' ], 'lemon', 1); // [ 'apple', 'banana', 'lemon' ]

// as a method
Array.prototype.remove = removeValue;

var list = [ 'apple', 'lemon', 'banana' ];

list.remove('banana');
list; // [ 'apple', 'lemon' ]

Alters the array "by reference" and returns the array.

License

MIT © Thomas Jensen