Matches strings against configurable strings, globs, regular expressions, and/or functions
76
Builds a curried matcher from mixed criteria and reuses it for repeated filtering of path-like strings.
src/utils/file.js and false for non-matching entries like README.md, even when reused across multiple invocations. @testreturnIndex yields the index of the first matching matcher (e.g., 1 for a regex hit) or -1 when nothing matches. @test@generates
/**
* Builds a reusable matcher from a list of matchers and optional glob options.
* @param {Array<string|RegExp|Function>|string|RegExp|Function} matchers
* @param {object} [options]
* @returns {(value: string|string[], returnIndex?: boolean) => boolean|number}
*/
export function createReusableTester(matchers, options);
/**
* Filters a list of values using a reusable tester; when returnIndex is true it maps to matcher indices instead of values.
* @param {Array<string|string[]>} values
* @param {(value: string|string[], returnIndex?: boolean) => boolean|number} tester
* @param {boolean} [returnIndex]
* @returns {Array<string|number>}
*/
export function filterWithTester(values, tester, returnIndex);Provides curried matcher generation for strings, globs, regexes, and predicate functions.
Install with Tessl CLI
npx tessl i tessl/npm-anymatch