@surface/path-matcher
Version:
Provides path matching capabilities.
47 lines (46 loc) • 1.39 kB
TypeScript
export type Options = {
/** Base path used to resolve relative patterns. */
base?: string;
/** Allow patterns to match dotfiles. Otherwise dotfiles are ignored unless a `.` is explicitly defined in the pattern. */
dot?: boolean;
/** Disables brace matching `{js,ts}, {a..z}, {0..10}`. */
noBrace?: boolean;
/** Perform case-insensitive matching. */
noCase?: boolean;
/** Disables pattern lists matching `!(..), @(..), +(..) *(..)`. */
noExtGlob?: boolean;
/** Disables GlobStar matching `**`.*/
noGlobStar?: boolean;
/** Disables negate matching. `!/foo/**` */
noNegate?: boolean;
};
export default class Parser {
private readonly source;
private readonly options;
private index;
private context;
constructor(source: string, options?: Options);
private advance;
private eos;
private escape;
private getChar;
private getNextChar;
private getPreviousChar;
private lookahead;
private scanBraces;
private scanClasses;
private scanEscaped;
private scanLiteral;
private scanNegation;
private scanQuotes;
private scanPattern;
private scanPatternList;
private scanPlaceholder;
private scanSlash;
private scanStar;
parse(): RegExp;
split(): {
path: string;
pattern: string;
};
}