-
-
Notifications
You must be signed in to change notification settings - Fork 933
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor!: remove v8 deprecated faker class parts (#2682)
- Loading branch information
1 parent
260ffc6
commit a9dc701
Showing
2 changed files
with
27 additions
and
240 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
### Remove deprecated faker constructor and deprecated JS backwards compatibility | ||
|
||
Removed deprecated faker constructor, so it is not possible anymore to just pass a locale string identifier. | ||
|
||
Also removed the accessors and method that were only for JS backwards compatibility. | ||
|
||
- `get/set locales` | ||
- `get/set locale` | ||
- `get/set localeFallback` | ||
- `setLocale` | ||
|
||
To use the new constructor, you need to pass a locale object like: | ||
|
||
```ts | ||
import { Faker, es, base } from '@faker-js/faker'; | ||
|
||
// A custom faker instance that does not have any fallbacks | ||
const customEsFakerWithoutFallback = new Faker({ locale: es }); | ||
|
||
// A custom faker instance that has only base-data as fallback, but not english data | ||
const customEsFakerWithFallback = new Faker({ locale: [es, base] }); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters