1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- var baseIteratee = require('./_baseIteratee'),
- basePullAt = require('./_basePullAt');
- function remove(array, predicate) {
- var result = [];
- if (!(array && array.length)) {
- return result;
- }
- var index = -1,
- indexes = [],
- length = array.length;
- predicate = baseIteratee(predicate, 3);
- while (++index < length) {
- var value = array[index];
- if (predicate(value, index, array)) {
- result.push(value);
- indexes.push(index);
- }
- }
- basePullAt(array, indexes);
- return result;
- }
- module.exports = remove;
|