Skip to content

Latest commit

 

History

History
15 lines (10 loc) · 583 Bytes

.verb.md

File metadata and controls

15 lines (10 loc) · 583 Bytes

Usage

var filter = require('{%= name %}');

filter(['a', {a: 'b'}, 1, 'b', 2, {c: 'd'}, 'c'], function (ele) {
  return typeof ele === 'string';
});
//=> ['a', 'b', 'c']

Why another array filter?

array-filter is pretty popular, but it's tuned to be used in older browsers and it falls back on native .filter() when available, which is much slower. See jsperf results. The functions used in the benchmarks are the top performers from a dozen or so other functions.