diff --git a/src/definitions/location.ts b/src/definitions/location.ts index 5b4a4bc33d1..da86bc8e72d 100644 --- a/src/definitions/location.ts +++ b/src/definitions/location.ts @@ -14,7 +14,7 @@ export type LocationDefinition = LocaleEntry<{ /** * Postcodes patterns. */ - postcode: string | string[]; + postcode_pattern: string[]; /** * The patterns to generate city names. diff --git a/src/modules/location/index.ts b/src/modules/location/index.ts index 88f4a9cb711..9f506200e8b 100644 --- a/src/modules/location/index.ts +++ b/src/modules/location/index.ts @@ -179,15 +179,9 @@ export class LocationModule extends ModuleBase { return this.faker.helpers.replaceSymbols(format); } - let zipPattern = this.faker.definitions.location.postcode; - - if (typeof zipPattern === 'string') { - zipPattern = [zipPattern]; - } - - zipPattern = this.faker.helpers.arrayElement(zipPattern); - - return this.faker.helpers.replaceSymbols(zipPattern); + return this.faker.helpers.fake( + this.faker.definitions.location.postcode_pattern + ); } /**