Files
SnowLuma/.pnpm-store/v11/files/f9/b27aa4f5ca7249a72839469dc4c78a5b79085715a7a35904ec066da19d9bf0c3cdd38cfd02903de86c05127f1dd4d5ee088bdb97f942766107240a0aeddf4c
TanTan 2a69b23b47
Dev Build / cleanup (push) Canceled after 0s
Dev Build / typecheck (push) Canceled after 0s
Dev Build / build (linux-arm64, ubuntu-24.04-arm, linux-arm64) (push) Canceled after 0s
Dev Build / build (linux-x64, ubuntu-latest, linux-x64) (push) Canceled after 0s
Dev Build / build (win-x64, windows-latest, win32-x64) (push) Canceled after 0s
Dev Build / dispatch-dev-docker (push) Canceled after 0s
docs: 仓库链接指向本镜像仓库
2026-11-13 09:27:07 +08:00

39 lines
1.1 KiB
Plaintext

import { REGEXEN } from '../../data/const.mjs';
import { sorted } from '../../utils/helper.mjs';
import { MatcherBaseClass } from '../../types.mjs';
/*
* -------------------------------------------------------------------------------
* regex matching ---------------------------------------------------------------
* -------------------------------------------------------------------------------
*/
class MatchRegex extends MatcherBaseClass {
match({
password
}) {
const matches = [];
Object.keys(REGEXEN).forEach(name => {
const regex = REGEXEN[name];
regex.lastIndex = 0; // keeps regexMatch stateless
let regexMatch;
while (regexMatch = regex.exec(password)) {
if (regexMatch) {
const token = regexMatch[0];
matches.push({
pattern: 'regex',
token,
i: regexMatch.index,
j: regexMatch.index + regexMatch[0].length - 1,
regexName: name,
regexMatch
});
}
}
});
return sorted(matches);
}
}
export { MatchRegex as default };
//# sourceMappingURL=matching.mjs.map