UNPKG

any-match

Version:

Determine if a single match exists with an array of strings/numbers/regexes.

14 lines (7 loc) 223 B
"use strict"; const isRegExp = require("is-regexp"); const anyMatch = (needle, haystack) => haystack.some(strand => { return isRegExp(strand) ? strand.test(needle) : strand === needle; }); module.exports = anyMatch;