UNPKG

zxcvbn

Version:

realistic password strength estimation

35 lines (28 loc) 925 B
// Generated by CoffeeScript 1.9.3 var matching, scoring, time, zxcvbn; matching = require('./matching'); scoring = require('./scoring'); time = function() { return (new Date()).getTime(); }; zxcvbn = function(password, user_inputs) { var arg, i, len, matches, ref, result, sanitized_inputs, start; if (user_inputs == null) { user_inputs = []; } start = time(); sanitized_inputs = []; for (i = 0, len = user_inputs.length; i < len; i++) { arg = user_inputs[i]; if ((ref = typeof arg) === "string" || ref === "number" || ref === "boolean") { sanitized_inputs.push(arg.toString().toLowerCase()); } } matching.set_user_input_dictionary(sanitized_inputs); matches = matching.omnimatch(password); result = scoring.minimum_entropy_match_sequence(password, matches); result.calc_time = time() - start; return result; }; module.exports = zxcvbn; //# sourceMappingURL=main.js.map