every-index-of
v1.2.1
Published
Returns every index o a given character in an string.
Downloads
5
Readme
every-index-of
Simple piece of code tha returns every occurence of a single character in a string by it index.
Installation
$ npm install every-index-of
Usage
var evrIndex = require('every-index-of');
let all;
evrIndex('m', 'Common', (err, indexes)=>{
if (err) { throw err; }
all = indexes;
})
Should return an array like so:
[2, 3]
#Or the case sensitive vertion:
var evrIndex = require('every-index-of');
let all;
evrIndex('M', 'Common', true, (err, indexes)=>{
if (err) { throw err; }
all = indexes;
})
Should return:
-1
Features
- Case insensetive
- return -1 if there are no occurences