|
1 |
| -# Upgrading to v7 |
| 1 | +# Upgrading to v8 |
2 | 2 |
|
3 |
| -This is the migration guide for upgrading from v6 to v7. |
| 3 | +This is the migration guide for upgrading from v7 to v8. |
| 4 | + |
| 5 | +Since v8 has not yet been released, this is a work in progress list of any major and breaking changes in v8. |
4 | 6 |
|
5 | 7 | ::: info
|
6 | 8 | Not the version you are looking for?
|
7 | 9 |
|
8 |
| -- [v6.fakerjs.dev](https://v6.fakerjs.dev/migration-guide-v5/) |
| 10 | +- [Upgrading to v7](https://v7.fakerjs.dev/guide/upgrading.html) |
| 11 | +- [Upgrading to v6](https://v6.fakerjs.dev/migration-guide-v5/) |
9 | 12 |
|
10 | 13 | :::
|
11 | 14 |
|
12 |
| -## Node 12 no longer supported |
13 |
| - |
14 |
| -You need at least Node 14 to use Faker. |
15 |
| - |
16 |
| -## Default export removed |
17 |
| - |
18 |
| -If you were previously importing faker like this: |
19 |
| - |
20 |
| -```js |
21 |
| -import faker from '@faker-js/faker'; |
22 |
| -``` |
23 |
| - |
24 |
| -You must instead use: |
25 |
| - |
26 |
| -```js |
27 |
| -import { faker } from '@faker-js/faker'; |
28 |
| -``` |
29 |
| - |
30 |
| -## Deprecated methods changed |
31 |
| - |
32 |
| -Several methods were renamed or moved: |
33 |
| - |
34 |
| -| Old method | New alternative | |
35 |
| -| -------------------------- | ------------------------------------------------------ | |
36 |
| -| faker.random.number | faker.datatype.number | |
37 |
| -| faker.random.float | faker.datatype.float | |
38 |
| -| faker.random.arrayElement | faker.helpers.arrayElement | |
39 |
| -| faker.random.arrayElements | faker.helpers.arrayElements | |
40 |
| -| faker.random.objectElement | faker.helpers.objectKey <br> faker.helpers.objectValue | |
41 |
| -| faker.random.uuid | faker.datatype.uuid | |
42 |
| -| faker.random.boolean | faker.datatype.boolean | |
43 |
| -| faker.random.image | faker.image.image | |
44 |
| -| faker.random.hexaDecimal | faker.datatype.hexadecimal | |
45 |
| -| faker.helpers.randomize | faker.helpers.arrayElement | |
46 |
| -| faker.datatype.hexaDecimal | faker.datatype.hexadecimal | |
47 |
| -| faker.name.title | faker.name.jobTitle | |
48 |
| - |
49 |
| -## Deprecated methods removed |
50 |
| - |
51 |
| -Some methods were removed without a direct alternative. If you are using any of these methods you should build an object containing the specific properties you need. |
52 |
| - |
53 |
| -| Removed method | |
54 |
| -| ------------------------------- | |
55 |
| -| faker.helpers.createCard | |
56 |
| -| faker.helpers.contextualCard | |
57 |
| -| faker.helpers.userCard | |
58 |
| -| faker.time | |
59 |
| -| faker.helpers.createTransaction | |
| 15 | +## `faker.mersenne` and `faker.helpers.repeatString` removed |
| 16 | + |
| 17 | +`faker.mersenne` and `faker.helpers.repeatString` were only ever intended for internal use, and are no longer available. |
| 18 | + |
| 19 | +## Other deprecated methods replaced |
| 20 | + |
| 21 | +| Old method | New method | |
| 22 | +| ------------------------------- | ----------------------------------------------------------------- | |
| 23 | +| `faker.unique` | `faker.helpers.unique` | |
| 24 | +| `faker.fake` | `faker.helpers.fake` | |
| 25 | +| `faker.commerce.color` | `faker.color.human` | |
| 26 | +| `faker.company.companyName` | `faker.company.name` | |
| 27 | +| `faker.phone.phoneNumber` | `faker.phone.number` | |
| 28 | +| `faker.phone.phoneNumberFormat` | No direct replacement, see documentation for `faker.phone.number` | |
| 29 | +| `faker.phone.phoneFormats` | No direct replacement, see documentation for `faker.phone.number` | |
| 30 | + |
| 31 | +## `faker.name` changed to `faker.person` |
| 32 | + |
| 33 | +The whole `faker.name` module is now located at `faker.person`, as it contains more information than just names. |
| 34 | +The `faker.name.*` methods will continue to work as an alias in v8 and v9, but it is recommended to change to `faker.person.*` |
| 35 | + |
| 36 | +| Old method | New method | |
| 37 | +| -------------------------- | ----------------------------------------------- | |
| 38 | +| `faker.name.firstName` | `faker.person.firstName` | |
| 39 | +| `faker.name.lastName` | `faker.person.lastName` | |
| 40 | +| `faker.name.middleName` | `faker.person.middleName` | |
| 41 | +| `faker.name.fullName` | `faker.person.fullName` | |
| 42 | +| `faker.name.gender` | `faker.person.gender` | |
| 43 | +| `faker.name.sex` | `faker.person.sex` | |
| 44 | +| `faker.name.sexType` | `faker.person.sexType` | |
| 45 | +| `faker.name.prefix` | `faker.person.prefix` | |
| 46 | +| `faker.name.suffix` | `faker.person.suffix` | |
| 47 | +| `faker.name.jobTitle` | `faker.person.jobTitle` | |
| 48 | +| `faker.name.jobDescriptor` | `faker.person.jobDescriptor` | |
| 49 | +| `faker.name.jobArea` | `faker.person.jobArea` | |
| 50 | +| `faker.name.jobType` | `faker.person.jobType` | |
| 51 | +| `faker.name.findName` | _Removed, replace with `faker.person.fullName`_ | |
| 52 | + |
| 53 | +## `faker.address` changed to `faker.location` |
| 54 | + |
| 55 | +The whole `faker.address` module is now located at `faker.location`, as it contains more information than just addresses. |
| 56 | +The `faker.address.*` methods will continue to work as an alias in v8 and v9, but it is recommended to change to `faker.location.*` |
| 57 | + |
| 58 | +| Old method | New method | |
| 59 | +| ----------------------------------- | ------------------------------------ | |
| 60 | +| `faker.address.buildingNumber` | `faker.location.buildingNumber` | |
| 61 | +| `faker.address.cardinalDirection` | `faker.location.cardinalDirection` | |
| 62 | +| `faker.address.city` | `faker.location.city` | |
| 63 | +| `faker.address.cityName` | `faker.location.cityName` | |
| 64 | +| `faker.address.country` | `faker.location.country` | |
| 65 | +| `faker.address.countryCode` | `faker.location.countryCode` | |
| 66 | +| `faker.address.county` | `faker.location.county` | |
| 67 | +| `faker.address.direction` | `faker.location.direction` | |
| 68 | +| `faker.address.faker` | `faker.location.faker` | |
| 69 | +| `faker.address.latitude` | `faker.location.latitude` | |
| 70 | +| `faker.address.longitude` | `faker.location.longitude` | |
| 71 | +| `faker.address.nearbyGPSCoordinate` | `faker.location.nearbyGPSCoordinate` | |
| 72 | +| `faker.address.ordinalDirection` | `faker.location.ordinalDirection` | |
| 73 | +| `faker.address.secondaryAddress` | `faker.location.secondaryAddress` | |
| 74 | +| `faker.address.state` | `faker.location.state` | |
| 75 | +| `faker.address.stateAbbr` | `faker.location.stateAbbr` | |
| 76 | +| `faker.address.street` | `faker.location.street` | |
| 77 | +| `faker.address.streetAddress` | `faker.location.streetAddress` | |
| 78 | +| `faker.address.streetName` | `faker.location.streetName` | |
| 79 | +| `faker.address.timeZone` | `faker.location.timeZone` | |
| 80 | +| `faker.address.zipCode` | `faker.location.zipCode` | |
| 81 | +| `faker.address.zipCodeByState` | `faker.location.zipCodeByState` | |
| 82 | +| `faker.address.cityPrefix` | _Removed_ | |
| 83 | +| `faker.address.citySuffix` | _Removed_ | |
| 84 | +| `faker.address.streetPrefix` | _Removed_ | |
| 85 | +| `faker.address.streetSuffix` | _Removed_ | |
| 86 | + |
| 87 | +## Locale renamed |
| 88 | + |
| 89 | +The `en_IND` (English, India) locale was renamed to `en_IN` for consistency with other locales. |
0 commit comments