sequential-indexof
Returns the index of the first instance; when called a second time, returns the index of the second instance; and so on. Works with arrays and strings. Packaged as a Node.js module.
Installation
npm install sequential-indexof --save
Usage
const sequentialIndexOf = const array = 'a' 'b' 'a'const indexOf = // returns a function // returns 0, the first index of 'a' // returns 2, the second index of 'a' // returns -1, since there are no more instances of 'a' // returns 1, the first index of 'b' // returns -1, since there are no more instances of 'b' // returns -1, since there are no instances of 'c'