zxcvbn
zxcvbn copied to clipboard
"Matcher pwned already exists" warning message issue
v3.0.4
When I use the following config, I get the warning "Matcher pwned already exists". I still works as expected, just not sure why I am getting this message?
export const configureZXCVBN = async (): Promise<void> => {
const zxcvbnCommonPackage = await import('@zxcvbn-ts/language-common')
const zxcvbnEnPackage = await import('@zxcvbn-ts/language-en')
const options: Pick<Partial<typeof zxcvbnOptions>, 'dictionary' | 'graphs' | 'translations'> = {
dictionary: {
...zxcvbnCommonPackage.dictionary,
...zxcvbnEnPackage.dictionary
},
graphs: zxcvbnCommonPackage.adjacencyGraphs,
translations: {
...zxcvbnEnPackage.translations
}
}
const matcherPwned = matcherPwnedFactory(fetch, zxcvbnOptions)
zxcvbnOptions.addMatcher('pwned', matcherPwned)
zxcvbnOptions.setOptions(options)
}
It just tells you that you add the matcher multiple times and probably triggering the options multiple times which if triggered to often in a short amount of time is bad.
But this issue should be gone in 4.0.0 as zxcvbn will be class which can be initalized with a fixed set of options