Merge pull request #150 from kingdavidmartins/add-without

Add without
This commit is contained in:
Angelos Chalaris
2017-12-15 12:42:12 +02:00
committed by GitHub
2 changed files with 13 additions and 0 deletions

12
snippets/without.md Normal file
View File

@ -0,0 +1,12 @@
### Without
Use `Array.filter()` to create an array excluding all given values
```js
const without = (arr, ...args) => arr.filter(v => args.indexOf(v) === -1)
// without[2, 1, 2, 3], 1, 2) -> [3]
// without([2, 1, 2, 3, 4, 5, 5, 5, 3, 2, 7, 7], 3, 1, 5, 2) -> [ 4, 7, 7 ]
```

View File

@ -85,3 +85,4 @@ UUID-generator:utility
validate-email:utility validate-email:utility
validate-number:utility validate-number:utility
value-or-default:utility value-or-default:utility
without:array