
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
array-filter
Advanced tools
Array#filter for older browsers.
var filter = require('array-filter');
var array = [1, 2, 3];
console.log(filter(array, function (el, i, arr) {
return false; // I throw it on the ground!
}));
// => []
Return an array with elements of arr for which fn returns a truthy value. fn is called with
el: The current elementi: The element's indexarr: The whole arrayOptionally pass in self as the this value for fn.
With npm do
$ npm install array-filter
Then bundle for the browser with browserify.
(MIT)
Copyright (c) 2013 Julian Gruber <julian@juliangruber.com>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Lodash is a modern JavaScript utility library delivering modularity, performance, and extras. It provides a wide range of utility functions, including array filtering with the _.filter method. Compared to array-filter, Lodash offers a more comprehensive set of utilities beyond just filtering.
Underscore is a JavaScript library that provides a whole mess of useful functional programming helpers without extending any built-in objects. It includes a filter function similar to array-filter but also offers many other utilities for working with arrays, objects, and functions.
Ramda is a practical functional library for JavaScript programmers. It makes it easy to create functional pipelines and includes a filter function. Ramda emphasizes a functional programming approach, which can be more powerful and flexible compared to the simpler array-filter.
FAQs
Array#filter for older browsers.
The npm package array-filter receives a total of 1,022,687 weekly downloads. As such, array-filter popularity was classified as popular.
We found that array-filter demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.