* A specialized version of `_.filter` for arrays without support for * iteratee shorthands. * * @private * @param {Array} [array] The array to iterate over. * @param {Function} predicate The function invoked per iteration. * @returns {Array} Returns the new filtered array.
(array, predicate)
| 50873 | * @returns {Array} Returns the new filtered array. |
| 50874 | */ |
| 50875 | function arrayFilter(array, predicate) { |
| 50876 | var index = -1, |
| 50877 | length = array == null ? 0 : array.length, |
| 50878 | resIndex = 0, |
| 50879 | result = []; |
| 50880 | |
| 50881 | while (++index < length) { |
| 50882 | var value = array[index]; |
| 50883 | if (predicate(value, index, array)) { |
| 50884 | result[resIndex++] = value; |
| 50885 | } |
| 50886 | } |
| 50887 | return result; |
| 50888 | } |
| 50889 | |
| 50890 | module.exports = arrayFilter; |
| 50891 |