Skip to content

#6 Add new check

Axorax edited this page Apr 14, 2023 · 3 revisions

If you added checks to new kith(), it would remove the existing checks and over-ride them with the new ones. With this method, it will add a new check to the existing ones. Meaning that when you use pass.test() it will use the existing built-in checks and also use the check you added newly.

const pass = new kith();

pass.addCheck('checkName', {
    "score": 15,
    "code": "lol" // does it have the word "lol" in the password
});

console.log(pass.test('hello-lol'))

output:

{
  score: 80,
  checks: {
    length: true,
    repeated: false,
    symbols: true,
    uppercase: false,
    lowercase: true,
    numbers: false,
    checkName: true
  },
  rejected: false
}
Clone this wiki locally