
Security News
NVD Concedes Inability to Keep Pace with Surging CVE Disclosures in 2025
Security experts warn that recent classification changes obscure the true scope of the NVD backlog as CVE volume hits all-time highs.
indexed-filter
Advanced tools
Array#filter
with also detecting indexes of filtered values
const arr = [1, 'foo', 2, 'bar'];
arr.filter(v => typeof v === 'string');
//=> ['foo', 'bar']
indexedFilter(arr, v => typeof v === 'string');
//=> [{index: 1, value: 'foo'}, {index: 3, value: 'bar'}]
npm install indexed-filter
import indexedFilter from 'indexed-filter';
array: Array
filterFn: Function
thisObject: (any value)
Return: Array
The API is vely similar to ECMAScript's built-in Array#filter
. There are only two differences:
.filter()
method on the array instance.index
(array index) and value
(array element).indexedFilter([0, [1], [2], '3', [5]], function(val, index, arr) {
return this.isArray(val) && index % 2 === 0 && index < arr.length * 0.5;
}, Array);
//=> [{index: 2, value: [2]}]
Copyright (c) 2015 - 2018 Shinnosuke Watanabe
Licensed under the MIT License.
FAQs
Array#filter() with also detecting indexes of filtered values
The npm package indexed-filter receives a total of 19,735 weekly downloads. As such, indexed-filter popularity was classified as popular.
We found that indexed-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.
Security News
Security experts warn that recent classification changes obscure the true scope of the NVD backlog as CVE volume hits all-time highs.
Security Fundamentals
Attackers use obfuscation to hide malware in open source packages. Learn how to spot these techniques across npm, PyPI, Maven, and more.
Security News
Join Socket for exclusive networking events, rooftop gatherings, and one-on-one meetings during BSidesSF and RSA 2025 in San Francisco.