feat(locale): add Welsh (cy) postcode definitions#3851
Conversation
✅ Deploy Preview for fakerjs ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
| export default [ | ||
| '{{location.postcode_prefix}}# #??', | ||
| '{{location.postcode_prefix}}## #??', | ||
| ]; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## next #3851 +/- ##
=======================================
Coverage 98.91% 98.91%
=======================================
Files 905 905
Lines 3146 3146
Branches 581 581
=======================================
Hits 3112 3112
Misses 30 30
Partials 4 4
🚀 New features to boost your workflow:
|
Based on the `en_GB` postcode definitions with prefix as recommened by @matthewmayer.
There was a problem hiding this comment.
Please make sure to test your changes and verify that they return the expected results
fakerCY.location.zipCode() // "{{location.postcode_prefix}}76 2MM"Currently, the zipcode implementation does not support fake patterns (for default patterns).
This is planned for #3233 / #3176
Until then, you have to cross-product them yourself.
Oof that's embarrising 🤦 Just a heads up it will be away for a while before I can come back to this :) @ST-DDT what do you mean by 'cross-product this myself?' Is it that:
I pushed a WIP commit of doing the latter, it seems to work. WIP as I would like to update some tests check that the other locales work as well and add documentation. Also whats the easiest way to run faker locally? via testing or starting |
|
Yes, do it by hand like
|
|
In the long run we would like to move to fake patterns and drop use of replaceSymbols completely, but that will potentially be a breaking change and impacts many locales, so the "by hand" trick is the easiest for now. |
There are 4 ways. In descending order of my personal preference.
@faker-js/members Should we document that somewhere or prepare a commamd for that like |
|
IMO this is a really niche case. However you could store scripts in Line 6 in 8b4e2b1 |
Personally I do Now you are in node REPL so can do like: const {fakerCY}=require(".")
fakerCY.location.zipCode() |
|
I created a separate issue to discuss dev verification tooling and documentation: |
Thanks for the heads up.
Sorry, for not being more clear. I didn't mean add const suffixes = ['`## ##?', ...]
const prefixes = ['CY', ...]
export prefixes.flatMap(prefix => suffixes.map(suffix => prefix+suffix))Either like this or only the result of it. |
Based on the
en_GBpostcode definitions with a prefix as recommened by @matthewmayer in #3850 (comment)