00001 var baseIteratee = require('./_baseIteratee'), 00002 basePullAt = require('./_basePullAt'); 00003 00032 function remove(array, predicate) { 00033 var result = []; 00034 if (!(array && array.length)) { 00035 return result; 00036 } 00037 var index = -1, 00038 indexes = [], 00039 length = array.length; 00040 00041 predicate = baseIteratee(predicate, 3); 00042 while (++index < length) { 00043 var value = array[index]; 00044 if (predicate(value, index, array)) { 00045 result.push(value); 00046 indexes.push(index); 00047 } 00048 } 00049 basePullAt(array, indexes); 00050 return result; 00051 } 00052 00053 module.exports = remove;