password-analysis
Version:
A library for analyzing the strength of a password
18 lines (17 loc) • 615 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.detectRepeats = detectRepeats;
exports.detectSequences = detectSequences;
exports.detectKeyboardPatterns = detectKeyboardPatterns;
function detectRepeats(password) {
const repeatPattern = /(\w)\1{2,}/;
return repeatPattern.test(password);
}
function detectSequences(password) {
const sequencePattern = /(?:abc|123|qwerty|asdfg)/i;
return sequencePattern.test(password);
}
function detectKeyboardPatterns(password) {
const keyboardPattern = /(?:qwerty|asdf|zxcv)/i;
return keyboardPattern.test(password);
}