@ray-js/library
Version:
Ray library for browser
25 lines (24 loc) • 622 B
TypeScript
interface ExecArray extends RegExpExecArray {
groups?: Record<string, string> | undefined;
}
/**
* 实现 Named Groups RegExp 的正则百表达式
* ECMA 2018 的实现
* 通过 new RegExp 运算符,无法被 babel 转义
*/
export default class NamedRegexp {
regex: RegExp;
groups: string[];
/**
* 创建 Named RegExp
* @param {object} options
* @param {RegExp} options.regex 正则
* @param {Array<String>} options.groups 分组
*/
constructor(options: {
regex: RegExp;
groups: string[];
});
exec(value: string): ExecArray | null;
}
export {};