every-index-of

1.2.1 • Public • Published

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

Readme

Keywords

Package Sidebar

Install

npm i every-index-of

Weekly Downloads

3

Version

1.2.1

License

MIT

Last publish

Collaborators

  • desoares