| 1 | ## Usage |
| 2 | |
| 3 | ```js |
| 4 | var filter = require('{%= name %}'); |
| 5 | |
| 6 | filter(['a', {a: 'b'}, 1, 'b', 2, {c: 'd'}, 'c'], function (ele) { |
| 7 | return typeof ele === 'string'; |
| 8 | }); |
| 9 | //=> ['a', 'b', 'c'] |
| 10 | ``` |
| 11 | |
| 12 | ## Why another array filter? |
| 13 | |
| 14 | [array-filter](https://github.com/juliangruber/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](http://jsperf.com/array-filter-while-vs-for/2). The functions used in the benchmarks are the top performers from a dozen or so other functions. |
| 15 |