fuzzy-regex
Version:
A regular expression library for Node.js that allows for a configurable number of mismatches (fuzzy matching), powered by the high-performance [TRE](https://laurikari.net/tre/) regex engine. This package supports both ESM and CommonJS, and provides a simp
20 lines (18 loc) • 529 B
TypeScript
type FuzzyRegex = {
test: (str: string) => boolean;
exec: (str: string) => string[] | null;
toString: () => string;
};
type FuzzyRegexOptions = {
caseInsensitive?: boolean;
costIns?: number;
costDel?: number;
costSubst?: number;
maxCost?: number;
maxIns?: number;
maxDel?: number;
maxSubst?: number;
maxErr?: number;
};
declare function fuzzyRegex(pattern: string | RegExp, options?: FuzzyRegexOptions): FuzzyRegex;
export { type FuzzyRegex, type FuzzyRegexOptions, fuzzyRegex };