Skip to content

tjconcept/js-remove-value

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Remove array item(s) by value (JavaScript)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published