-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(remove-from-array): added new func to remove all of specific ite…
…m from array
- Loading branch information
1 parent
ed8e0c7
commit 7e580c8
Showing
4 changed files
with
51 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
const removeFrom = require("./util/removeFrom"); | ||
const removeFromString = require("./util/removeFromString"); | ||
const removeFromArray = require("./util/removeFromArray"); | ||
|
||
module.exports = { | ||
removeFrom | ||
removeFromString, | ||
removeFromArray | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/** | ||
* | ||
* Summary - Remove from *array* `x`, all of specific item `y` | ||
* | ||
* Description - This method removes | ||
* all of specific item of *any* `y` from *array* `x` | ||
* | ||
* @name removeFromArray | ||
* | ||
* @param {array} x - array | ||
* @param {any} y - any | ||
* | ||
* @since 1.0.1 | ||
* @access public | ||
* | ||
* @return `x` with all of specific item `y` removed | ||
*/ | ||
|
||
module.exports = (x, y) => { | ||
return Array.isArray(x) | ||
? x.filter((item) => item !== y) | ||
: new Error("x is not of type array"); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters