Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(helpers): document unique deprecation #2001

Merged
merged 5 commits into from
Apr 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 20 additions & 15 deletions docs/guide/upgrading.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,21 +103,21 @@ For more information refer to our [Localization Guide](localization).

### Other deprecated methods removed/replaced

| Old method | New method |
| ------------------------------- | ----------------------------------------------------------------- |
| `faker.unique` | `faker.helpers.unique` |
| `faker.fake` | `faker.helpers.fake` |
| `faker.commerce.color` | `faker.color.human` |
| `faker.company.companyName` | `faker.company.name` |
| `faker.phone.phoneNumber` | `faker.phone.number` |
| `faker.phone.phoneNumberFormat` | No direct replacement, see documentation for `faker.phone.number` |
| `faker.phone.phoneFormats` | No direct replacement, see documentation for `faker.phone.number` |
| `faker.name.findName` | _Removed, replace with `faker.person.fullName`_ |
| `faker.address.cityPrefix` | _Removed_ |
| `faker.address.citySuffix` | _Removed_ |
| `faker.address.streetPrefix` | _Removed_ |
| `faker.address.streetSuffix` | _Removed_ |
| `faker.image.lorempixel` | _Removed, as the LoremPixel service is no longer available_ |
| Old method | New method |
| ------------------------------- | --------------------------------------------------------------------------------------------------------------- |
| `faker.unique` | `faker.helpers.unique` (:warning: please have a look at [#1785](https://github.com/faker-js/faker/issues/1785)) |
| `faker.fake` | `faker.helpers.fake` |
| `faker.commerce.color` | `faker.color.human` |
| `faker.company.companyName` | `faker.company.name` |
| `faker.phone.phoneNumber` | `faker.phone.number` |
| `faker.phone.phoneNumberFormat` | No direct replacement, see documentation for `faker.phone.number` |
| `faker.phone.phoneFormats` | No direct replacement, see documentation for `faker.phone.number` |
| `faker.name.findName` | _Removed, replace with `faker.person.fullName`_ |
| `faker.address.cityPrefix` | _Removed_ |
| `faker.address.citySuffix` | _Removed_ |
| `faker.address.streetPrefix` | _Removed_ |
| `faker.address.streetSuffix` | _Removed_ |
| `faker.image.lorempixel` | _Removed, as the LoremPixel service is no longer available_ |

## Deprecations and other changes

Expand Down Expand Up @@ -216,6 +216,11 @@ The `allowLeadingZeros` boolean parameter in `faker.string.numeric` (in the new

The functions `faker.system.mimeType`, `faker.system.fileType` and `faker.system.fileExt` now return data from a smaller set of more common MIME types, filetypes and extensions.

### `faker.helpers.unique` is planned to be outsourced

The `faker.helpers.unique` method is planned to be outsourced to a separate package.
Please have a look at issue [#1785](https://github.com/faker-js/faker/issues/1785) for more details.

### Locales renamed

The `en_IND` (English, India) locale was renamed to `en_IN` for consistency with other locales.
Expand Down
6 changes: 6 additions & 0 deletions docs/guide/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -249,4 +249,10 @@ const user = createRandomUser();

By wrapping Faker's `email` function with the [`unique`](../api/helpers.md#unique) helper function, we ensure that the return value of `email` is always unique.

::: warning
The `faker.helpers.unique` is targeted to be removed from Faker in the future.
Please have a look at the issue [#1785](https://github.com/faker-js/faker/issues/1785).
We will update these docs once a replacement is available.
:::

Congratulations, you should now be able to create any complex object you desire. Happy faking 🥳.