Package Exports
- array-find-predecessor
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (array-find-predecessor) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
str-indexes-of
Like String#indexOf
, but return all indexes instead of the first one
import strIndexesOf from 'str-indexes-of';
strIndexesOf('aaa', 'a'); //=> [0, 1, 2]
strIndexesOf('ffoofffofofofofofffooffoo', 'foo'); //=> [1, 18, 22]
Almost the same module as indexes-of, but:
- only supports
String
explicitly- throws
TypeError
when it takes anArray
- throws
- supports optional
fromIndex
parameter - disallows empty search value
Installation
npm
npm install str-indexes-of
bower
bower install str-indexes-of
API
strIndexesOf(str, searchValue [, fromIndex])
str: String
searchValue: String
(value to search for)
fromIndex: Number
(index in the string where to begin searching)
Return: Array
of String
strIndexesOf('ABC-ABC', 'A'); //=> [0, 4]
strIndexesOf('ABC-ABC', 'A', 4); //=> [4]
Related project
arr-indexes-of - Array#indexOf
version
License
Copyright (c) 2016 Shinnosuke Watanabe
Licensed under the MIT License.