-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Open
Labels
Description
Pre-Checks
- Follow our Code of Conduct.
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Make sure this is a Faker issue and not related to a combination with another package.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
- I am willing to provide a PR.
Describe the bug
Maybe related to #1416 and #2390 but for a different locale FR, so I though a new ticket would be appropriate.
AFAIK, French post codes don’t follow extensive rules (there too many exceptions), but basically:
- They are always 5 digits long and may contain one leading
0. - The first two or three digits are for the department code which goes from
01to95plus the following three digits codes for overseas administrative areas: range from971to978plus984, plus range from986to989.
Notably, the following ranges are not valid french post codes, and none of them would pass this validation regexp:
00000-0099996000-9699999000-99999
Minimal reproduction code
import { fakerFR as faker } from "@faker-js/faker";
import validator from 'validator';
console.log(validator.isPostalCode(faker.location.zipCode(), 'FR'));Additional Context
The french post codes are maintained by “La Poste” but I’m not aware of any guidelines regarding their attribution: https://datanova.laposte.fr/datasets/laposte-hexasmal
Environment Info
System:
OS: Linux 6.15 Fedora Linux 42 (Workstation Edition)
CPU: (16) x64 13th Gen Intel(R) Core(TM) i7-1360P
Memory: 4.51 GB / 13.35 GB
Container: Yes
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.16.0 - /usr/bin/node
npm: 10.9.2 - /usr/bin/npm
pnpm: 10.9.0 - /usr/bin/pnpm
npmPackages:
@faker-js/faker: ^9.8.0 => 9.8.0Which module system do you use?
- CJS
- ESM
Used Package Manager
npm