Skip to content

Commit

Permalink
feat!(zxcvbn): change usage of library
Browse files Browse the repository at this point in the history
BREAKING: we moved to a class based approach where the options are handled in the constructor to get rid of the option singleton
  • Loading branch information
MrWook committed Dec 8, 2023
1 parent 8c2e009 commit a88c8c1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/libraries/main/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@ and recognizes common patterns like dates, repetitions (e.g. 'aaa'), sequences (
## Setup

```js
import { zxcvbn, zxcvbnOptions } from '@zxcvbn-ts/core'
import { ZxcvbnFactory } from '@zxcvbn-ts/core'
import * as zxcvbnCommonPackage from '@zxcvbn-ts/language-common'
import * as zxcvbnEnPackage from '@zxcvbn-ts/language-en'

const password = 'somePassword'
const options = {
dictionary: {
...zxcvbnCommonPackage.dictionary,
Expand All @@ -31,7 +30,8 @@ const options = {
graphs: zxcvbnCommonPackage.adjacencyGraphs,
translations: zxcvbnEnPackage.translations,
}
zxcvbnOptions.setOptions(options)
const zxcvbn = new ZxcvbnFactory(options)

const password = 'somePassword'
zxcvbn(password)
```

0 comments on commit a88c8c1

Please sign in to comment.