MCPcopy Create free account
hub / github.com/RubyLouvre/anu / arrayFilter

Function arrayFilter

test/babel.js:50875–50888  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

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

Callers 1

babel.jsFile · 0.85

Calls 1

predicateFunction · 0.85

Tested by

no test coverage detected