diff --git a/docs/guide/upgrading.md b/docs/guide/upgrading.md index 673ab610e82..709a76d0523 100644 --- a/docs/guide/upgrading.md +++ b/docs/guide/upgrading.md @@ -124,6 +124,11 @@ faker.number.float({ max: 100, precision: 0.01 }); // 35.21 | `faker.datatype.float` | `faker.number.float` | | `faker.datatype.bigInt` | `faker.number.bigInt` | +### Deprecation of `faker.datatype.array` + +The method `faker.datatype.array` has been deprecated and will be removed in v9. +If you need an array of useful values, you are better off creating your own one using `faker.helpers.multiple`. + ### `allowLeadingZeros` behavior change in `faker.string.numeric` The `allowLeadingZeros` boolean parameter in `faker.string.numeric` (in the new `string` module) now defaults to `true`. `faker.string.numeric` will now generate numeric strings that could have leading zeros by default. diff --git a/src/modules/datatype/index.ts b/src/modules/datatype/index.ts index bf07cfd57a0..6a03362f486 100644 --- a/src/modules/datatype/index.ts +++ b/src/modules/datatype/index.ts @@ -419,6 +419,8 @@ export class DatatypeModule { * faker.datatype.array({ min: 3, max: 5 }) // [ 99403, 76924, 42281, "Q'|$&y\\G/9" ] * * @since 5.5.0 + * + * @deprecated Use your own function to build complex arrays. */ array( length: @@ -434,6 +436,13 @@ export class DatatypeModule { max: number; } = 10 ): Array { + deprecated({ + deprecated: 'faker.datatype.array()', + proposed: 'your own function to build complex arrays', + since: '8.0', + until: '9.0', + }); + return this.faker.helpers.multiple( () => this.boolean() ? this.faker.string.sample() : this.faker.number.int(),