Files
SnowLuma/.pnpm-store/v11/files/ba/b6bbb81b8314bc8b3024bcebcd4622c73259c41ba5f90096fc42ea9ff16b25df92b024992ad9b2bf43d40f679fa8cd3421a5c538c9347dcf422bdcb3c9a748
T
TanTan 2a69b23b47
Dev Build / cleanup (push) Waiting to run
Dev Build / typecheck (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:27:07 +08:00

28 lines
919 B
Plaintext

import MatchDictionary from '../../matching.mjs';
/*
* -------------------------------------------------------------------------------
* Dictionary reverse matching --------------------------------------------------
* -------------------------------------------------------------------------------
*/
class MatchReverse extends MatchDictionary {
match(matchOptions) {
const passwordReversed = matchOptions.password.split('').reverse().join('');
return super.match({
...matchOptions,
password: passwordReversed
}).map(match => ({
...match,
token: match.token.split('').reverse().join(''),
// reverse back
reversed: true,
// map coordinates back to original string
i: matchOptions.password.length - 1 - match.j,
j: matchOptions.password.length - 1 - match.i
}));
}
}
export { MatchReverse as default };
//# sourceMappingURL=reverse.mjs.map