Licence
MIT
Version
1.4.5
Deps
1
Size
12 kB
Vulns
0
Weekly
0
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