| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | 4x 4x | export class RegExp {
regexp: string;
options: string;
constructor({ regexp, options }) {
if (!regexp) {
throw new TypeError("regexp must be a string");
}
this.regexp = regexp;
this.options = options;
}
parse(key) {
return {
[key]: {
$regex: this.regexp,
$options: this.options
}
};
}
}
export function RegExpConstructor(param) {
return new RegExp(param);
}
|