find-char
Finds all the indices of a char in a string.
Node Repository
https://www.npmjs.com/package/@pelevesque/find-char
Installation
npm install @pelevesque/find-char
Tests
Standard Style & Unit Tests
npm test
Unit Tests & Coverage
npm run cover
Usage
find-char returns an array of all the indices of the char in the string.
If the char is not found, -1 is returned.
const findChar = require('@pelevesque/find-char')
const str = 'a little rabbit and an oxe'
const char = 'a'
const result = findChar(str, char)
// result === [0, 10, 16, 20]