Skip to content

pelevesque/find-substring-indexes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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]

About

Node.js | Finds all the indexes of a substring.

Resources

License

Stars

Watchers

Forks

Packages

No packages published