Finds all the indexes of a substring.
https://www.npmjs.com/package/@pelevesque/find-substring-indexes
npm install @pelevesque/find-substring-indexes
npm test
npm run cover
find-substring-indexes
returns an array of all the indexes of the substring.
const findSubstringIndexes = require('@pelevesque/find-substring-indexes')
const str = 'a little cat and a hat'
const substring = 'a'
const result = findSubstringIndexes(str, substring)
// result === [0, 10, 13, 17, 20]
const str = 'at a cat and a brat with a hat'
const substring = 'at'
const result = findSubstringIndexes(str, substring)
// result === [0, 6, 17, 28]