@digitak/grubber
Version:
Parse code files and patch it without having to use an AST
20 lines (19 loc) • 524 B
TypeScript
import { Match } from "./Match.js";
export declare type MatchRule = {
type: "match";
expression: string | RegExp;
from?: RegExp;
to?: string;
};
declare type Rule = MatchRule | {
type?: undefined;
expression: string | RegExp;
onExpressionMatch?: (match: Match) => boolean | void;
} | {
type?: undefined;
startAt: string | RegExp;
stopAt: string | RegExp;
onStartMatch?: (match: Match) => boolean | void;
onStopMatch?: (match: Match) => boolean | void;
};
export default Rule;