
Research
Security News
The Landscape of Malicious Open Source Packages: 2025 Mid‑Year Threat Report
A look at the top trends in how threat actors are weaponizing open source packages to deliver malware and persist across the software supply chain.
The npm package 'indexes-of' is a utility that allows you to find all the indexes of a value within an array. It is a simple and focused package that provides a straightforward method for this specific task.
Find indexes of a value in an array
This feature allows you to find all occurrences of a specific value within an array and returns an array of their indexes. In the code sample, it finds all indexes of the value '2' in the array.
const indexesOf = require('indexes-of');
const arr = [1, 2, 3, 2, 4];
const indexes = indexesOf(arr, 2); // returns [1, 3]
This package provides a method similar to the ES6 Array.prototype.findIndex. It returns the index of the first element in the array that satisfies the provided testing function. Unlike 'indexes-of', it does not return all indexes, just the first one.
Lodash is a well-known utility library that includes a findIndex function. This function is similar to 'array-find-index' and returns the index of the first element that passes a test. Lodash offers a wide range of utilities, whereas 'indexes-of' is more specialized.
This package extends the capabilities of matching patterns against strings or arrays. While it can be used to find indexes of matches in an array, it is more complex and feature-rich than 'indexes-of', which focuses solely on finding indexes of a value.
like Array/String#indexOf but return all the indexes in an array.
var indexesOf = require('indexes-of')
var twosIndexes = indexesOf([1, 2, 3, 4, 5, 4, 3, 2, 1], 2)
console.log(twosIndexes)
// [1, 7]
MIT
FAQs
line String/Array#indexOf but return all the indexes in an array
We found that indexes-of 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.
Research
Security News
A look at the top trends in how threat actors are weaponizing open source packages to deliver malware and persist across the software supply chain.
Security News
ESLint now supports HTML linting with 48 new rules, expanding its language plugin system to cover more of the modern web development stack.
Security News
CISA is discontinuing official RSS support for KEV and cybersecurity alerts, shifting updates to email and social media, disrupting automation workflows.