🚀 Socket Launch Week 🚀 Day 5: Introducing Socket Fix.Learn More
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jqb-array-remove

remove an element from an array by value

0.0.1
latest
Version published
Maintainers
1
Created

jqb-array-remove

Remove an array item given it's value:

var arrayRemove = require('jqb-array-remove');
arrayRemove([1, 2, 3], 2);             // [1, 3]
arrayRemove(['a','b','c'], 'a', 'b');  // ['c']

You can pass as many values to remove from the original array, it returns filtered array.

arrayRemove.at(arr, idx)

Remove the given index:

var arrayRemoveAt = require('jqb-array-remove').at;
arrayRemove([1, 2, 3], 2);             // [1, 2]
arrayRemove(['a','b','c'], 0);         // ['b', 'c']

arrayRemove.deep()

Remove items by value, it deelply check items so it's good for removing objects by value.
(new method, not optimised)

var arrayDeepRemove = require('jqb-array-remove').deep;
arrayRemove.deep([{a:1},{b:2},{c:3}], {b:2}) // [{a:1},{c:3}]

Run Tests

If you want to run tests on this module you can prompt:

npm install && grunt

FAQs

Package last updated on 20 Apr 2014

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