forked from selfrefactor/rambda
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolves selfrefactor#40
- Loading branch information
Jean-Paul Gorman
authored and
Jean-Paul Gorman
committed
Oct 10, 2017
1 parent
0e869e3
commit 74bda87
Showing
4 changed files
with
18 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
const R = require('../rambda') | ||
|
||
describe('without', () => { | ||
it('should return a new list without values in the first argument ', () => { | ||
const itemsToOmit = ['A', 'B', 'C'] | ||
const collection = ['A', 'B', 'C', 'D', 'E', 'F'] | ||
expect( | ||
R.without(itemsToOmit, collection) | ||
).toEqual([ 'D', 'E', 'F' ]) | ||
}) | ||
}) |
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,5 @@ | ||
import contains from './contains' | ||
|
||
export default function without(itemsToOmit, collection) { | ||
return collection.reduce((accum, item) => !contains(item, itemsToOmit) ? accum.concat(item) : accum, []) | ||
} |
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