Files
SnowLuma/.pnpm-store/v11/files/4c/ea9a608d9a2241b66ff6e85384f59365732314965609373e65d8a2938f5e65a7c1e0dd42e83cc8350f5b02620f43a229f3c61f135b67e529e44550256ee0c6
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

30 lines
781 B
Plaintext

'use strict';
var sequenceMatcher = ({
token,
ascending
}) => {
const firstChr = token.charAt(0);
let baseGuesses;
const startingPoints = ['a', 'A', 'z', 'Z', '0', '1', '9'];
// lower guesses for obvious starting points
if (startingPoints.includes(firstChr)) {
baseGuesses = 4;
} else if (/\d/.exec(firstChr)) {
baseGuesses = 10; // digits
} else {
// could give a higher base for uppercase,
// assigning 26 to both upper and lower sequences is more conservative.
baseGuesses = 26;
}
// need to try a descending sequence in addition to every ascending sequence ->
// 2x guesses
if (!ascending) {
baseGuesses *= 2;
}
return baseGuesses * token.length;
};
module.exports = sequenceMatcher;
//# sourceMappingURL=scoring.cjs.map