Skip to content
Draft
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
2 changes: 2 additions & 0 deletions src/definitions/location.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ export type LocationDefinition = LocaleEntry<{
[state: string]: string | string[];
};

postcode_prefix: string[];

/**
* Postcodes patterns.
*/
Expand Down
4 changes: 4 additions & 0 deletions src/locales/cy/location/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,15 @@ import type { LocationDefinition } from '../../..';
import county from './county';
import direction from './direction';
import postal_address from './postal_address';
import postcode from './postcode';
import postcode_prefix from './postcode_prefix';

const location: LocationDefinition = {
county,
direction,
postal_address,
postcode,
postcode_prefix,
};

export default location;
4 changes: 4 additions & 0 deletions src/locales/cy/location/postcode.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export default [
'{{location.postcode_prefix}}# #??',
'{{location.postcode_prefix}}## #??',
];
Copy link
Copy Markdown
Contributor Author

@IestynGage IestynGage May 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The en_GB is just export default ['??# #??', '??## #??']; I suppose you can also add a similiar prefix to en_GB as well. But the postcodes for England, NI, Scotland, Wales, crown dependecies and other special postcodes.

Copy link
Copy Markdown
Member

@ST-DDT ST-DDT May 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 change: 1 addition & 0 deletions src/locales/cy/location/postcode_prefix.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default ['CF', 'CH', 'HR', 'LD', 'LL', 'NP', 'SA', 'SY'];
3 changes: 3 additions & 0 deletions src/modules/location/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,10 @@
return this.faker.helpers.fake(zipPattern);
}

let { format = this.faker.definitions.location.postcode } = options;

Check failure on line 271 in src/modules/location/index.ts

View workflow job for this annotation

GitHub Actions / Lint: node-24, ubuntu-latest

The value assigned to 'format' is not used in subsequent statements

format = this.faker.helpers.fake(this.faker.definitions.location.postcode);

if (typeof format === 'string') {
format = [format];
}
Expand Down
2 changes: 1 addition & 1 deletion test/__snapshots__/locale-data.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ exports[`locale-data > should only have known characters 1`] = `
"base": " ()+,-./:;ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz",
"bn_BD": " (),-ঁংঅআইঈউএওকখগঘঙচছজঝঞটঠডঢণতথদধনপফবভমযরলশষসহ়ািীুূৃেৈোৌ্ড়য়",
"cs_CZ": " #()+-.ABCDEFGHIJKLMNOPRSTUVWXZabcdefghijklmnopqrstuvwxyzÁÍÚáéíóöúüýČčĎďěňŘřŠšťůűŽž",
"cy": " ,-ABCDEFGHILMNOPRSTWYabcdefghijklmnoprstuwyôŵ",
"cy": " #,-?ABCDEFGHILMNOPRSTWYabcdefghijklmnoprstuwyôŵ",
"da": " !"#()+,-./ABCDEFGHIJKLMNOPQRSTUVWYZabcdefghijklmnopqrstuvwxyzÅÆØãåæçéíø",
"de": " #&'()+,-.ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzÄÖÜßàãäéíöúü",
"de_AT": " #&()+,-.ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzÄÖÜßãäéíöúü",
Expand Down
Loading