index-of-any
v1.4.5
Published
Like string indexOf with multiple search strings
Downloads
160
Readme
index-of-any
- Like string indexOf with multiple search strings
Installation
npm install index-of-any
Usage
Search strings
import indexOfAny from "index-of-any";
const searchStrings = ["first", "second", "third"];
const [index, searchString] = indexOfAny("a string containing second search string");
==> [20, "second"]
Search arrays
import indexOfAny from "index-of-any";
const strings = ["first", "second", "third"];
const [index, searchString] = indexOfAny(strings, "second");
==> [2, "second"]
Test
npm test