Often you want to check if the password matches some user content like their username or email. For this purpose, add a userInputs dictionary with its own sanitizer.

import { zxcvbn, zxcvbnOptions } from '@zxcvbn-ts/core'

const password = 'somePassword'
const options = {
  dictionary: {
    userInputs: ['', 'someUsername'],


If you need to add the userInputs more dynamically your can add them as the second argument of the normal zxcvbn function like this

import { zxcvbn } from '@zxcvbn-ts/core'

const password = 'somePassword'

zxcvbn(password, ['', 'someUsername'])