* Removes all elements from `array` that `predicate` returns truthy for * and returns an array of the removed elements. The predicate is bound to * `thisArg` and invoked with three arguments: (value, index, array). * * If a property name is provided for `predicate` the created `_
(array, predicate, thisArg)
| 6796 | * // => [2, 4] |
| 6797 | */ |
| 6798 | function remove(array, predicate, thisArg) { |
| 6799 | var result = []; |
| 6800 | if (!(array && array.length)) { |
| 6801 | return result; |
| 6802 | } |
| 6803 | var index = -1, |
| 6804 | indexes = [], |
| 6805 | length = array.length; |
| 6806 | |
| 6807 | predicate = getCallback(predicate, thisArg, 3); |
| 6808 | while (++index < length) { |
| 6809 | var value = array[index]; |
| 6810 | if (predicate(value, index, array)) { |
| 6811 | result.push(value); |
| 6812 | indexes.push(index); |
| 6813 | } |
| 6814 | } |
| 6815 | basePullAt(array, indexes); |
| 6816 | return result; |
| 6817 | } |
| 6818 | |
| 6819 | /** |
| 6820 | * Gets all but the first element of `array`. |
nothing calls this directly
no test coverage detected