ex-indexof

1.0.0 • Public • Published

Extended-IndexOf

Extended indexOf for specific occurrence time.

var exIndexOf = require('ex-indexof');
 
exIndexOf('hello, world', 'o'); // => 4
exIndexOf('hello, world', 'o', 1); // => 8
exIndexOf('hello, world', 'o', 2); // => -1
 
// reverse direction
exIndexOf('hello, world', 'o', -1); // => 8
exIndexOf('hello, world', 'o', -2); // => 4
exIndexOf('hello, world', 'o', -3); // => -1
 
// substring
exIndexOf('too simple, too young, sometime naive', 'too', -2); // => 0

Readme

Keywords

Package Sidebar

Install

npm i ex-indexof

Weekly Downloads

1

Version

1.0.0

License

MIT

Last publish

Collaborators

  • springuper