@pelevesque/find-substring-indexes

0.0.1 • Public • Published

Build Status Coverage Status JavaScript Style Guide

find-substring-indexes

Finds all the indexes of a substring.

Node Repository

https://www.npmjs.com/package/@pelevesque/find-substring-indexes

Installation

npm install @pelevesque/find-substring-indexes

Tests

Standard Style & Unit Tests

npm test

Unit Tests & Coverage

npm run cover

Usage

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]

Package Sidebar

Install

npm i @pelevesque/find-substring-indexes

Weekly Downloads

0

Version

0.0.1

License

MIT

Unpacked Size

12.8 kB

Total Files

7

Last publish

Collaborators

  • pelevesque