Skip to content

jonschlinkert/arr-filter

Repository files navigation

arr-filter NPM version

Faster alternative to javascript's native filter method and 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, reduced down from 10 or 11 additional functions.

Install

Install with npm

npm i arr-filter --save

Install with bower

bower install arr-filter --save

Run tests

npm test

Usage

var filter = require('arr-filter');

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

Author

Jon Schlinkert

Other javascript/node.js utils

Other projects that I maintain:

License

Copyright (c) 2014 Jon Schlinkert, contributors.
Released under the MIT license


This file was generated by verb-cli on October 01, 2014.

About

fast array filter

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published