fix array-pull to pull out values correctly

This commit is contained in:
Sergey Chichulin
2017-12-17 14:33:52 +02:00
parent dda73dfdde
commit 2d28b22fb2

View File

@ -5,7 +5,7 @@ Use `Array.length = 0` to mutate the passed in array by resetting it's length to
```js
const pull = (arr, ...args) => {
let pulled = arr.filter((v, i) => args.includes(v));
let pulled = arr.filter((v, i) => !args.includes(v));
arr.length = 0; pulled.forEach(v => arr.push(v));
};
// let myArray = ['a', 'b', 'c', 'a', 'b', 'c'];