regex-indexof

1.0.3 • Public • Published

Build Status

Allows regex usage in indexOf function

install

npm i regex-indexof --save

usage

const regexIndexOf = require('regex-indexof')

Array.prototype.indexOf = regexIndexOf

console.log([1,2,3,4,5].indexOf(3))

2

console.log(['/app', /\/app\/[0-9]{1,}/].indexOf("/app"))

0

console.log(['/app', /\/app\/[0-9]{1,}/].indexOf("/app/2"))

1

// or

console.log(regexIndexOf(['/app', /\/app\/[0-9]{1,}/], "/app/2"))

1

Dependencies (0)

    Dev Dependencies (1)

    Package Sidebar

    Install

    npm i regex-indexof

    Weekly Downloads

    1

    Version

    1.0.3

    License

    MIT

    Unpacked Size

    2.01 kB

    Total Files

    6

    Last publish

    Collaborators

    • cond