index-of-any
TypeScript icon, indicating that this package has built-in type declarations

1.4.5 • Public • Published

index-of-any

  • Like string indexOf with multiple search strings

Build Status Codacy Badge code style: prettier Coverage Status David GitHub npm

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

Package Sidebar

Install

npm i index-of-any

Weekly Downloads

14

Version

1.4.5

License

MIT

Unpacked Size

12.7 kB

Total Files

27

Last publish

Collaborators

  • jaspenlind