UNPKG

react-collection-helpers

Version:
15 lines (11 loc) 372 B
import applyPredicateToCollectionWith from './apply-predicate-to-collection-with'; function efficientFilter(collection, predicate) { var matches = []; for (var i = 0; i < collection.length; i += 1) { if (predicate(collection[i])) { matches.push(collection[i]); } } return matches; } export default applyPredicateToCollectionWith(efficientFilter);