
Security News
TypeScript is Porting Its Compiler to Go for 10x Faster Builds
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
find-all-indexes
Advanced tools
Find all occurrences of a unique or multiple characters in a string or in an array (Buffer included)
Find all indexes allows you to find all occurrences of a unique or multiple characters in a string or in an array (Buffer included).
ES6:
import findAllIndexes from 'find-all-indexes'
const myString = 'kayak';
const myArray = ['k', 'a', 'y', 'a', 'k'];
const myBuffer = new Buffer([107, 97, 121, 97, 107]); // kayak
console.log(
findAllIndexes(myString, 'a'),
// [ 1, 3 ]
findAllIndexes(myString, ['a', 'k']),
// [ 1, 3, 0, 4 ]
findAllIndexes(myString, ['a', 'k'], {
sort: true
}),
// [ 0, 1, 3, 4 ]
findAllIndexes(myArray, 'y'),
// [ 2 ]
findAllIndexes(myBuffer, ['6B', '61'], {
hex: true,
sort: true
})
// [ 0, 1, 3, 4 ]
);
ES5:
var findAllIndexes = require('find-all-indexes').default;
var myString = 'kayak';
var myArray = ['k', 'a', 'y', 'a', 'k'];
var myBuffer = new Buffer([107, 97, 121, 97, 107]); // kayak
...
Feel free to open a pull request on GitHub!
MIT
FAQs
Find all occurrences of a unique or multiple characters in a string or in an array (Buffer included)
The npm package find-all-indexes receives a total of 0 weekly downloads. As such, find-all-indexes popularity was classified as not popular.
We found that find-all-indexes 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
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.