feat: add Luhn validator constraint - #212
Conversation
bcfa20a to
a7c29bf
Compare
ReviewOverall this is a solid PR, ready to merge after a few cosmetic fixes. The implementation is algorithmically equivalent to What I verified locally on the PR branch:
What's done right
Findings1. Wrong position in The file is alphabetically sorted; 2. Comment contradicts the code — // Checksum must be a multiple of 10 (and not zero, unless the input is "0")The parenthetical is wrong: 3. Trailing whitespace in 4. No trailing newline in 5. Missing Observations (non-blocking)
VerdictApprove with nits. Only items 1 ( |
|
Yes, please provide MRs to 1.7 branch |
|
Re-checked after
Verified locally on the PR branch (inside
|
Add Luhn validator for client-side validation of credit card numbers and other values (like SIRET) that must pass the Luhn algorithm. - Add Luhn.js constraint following the existing pattern - Add comprehensive tests in Luhn.test.js - Update index.js to import the new constraint The implementation follows Symfony's LuhnValidator.php logic: - Validates that the value contains only digits - Applies the Luhn algorithm to verify the checksum - Rejects values with checksum of 0 or not divisible by 10 Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
a3b53c4 to
fd2f755
Compare
|
Last leftover fixed, and commits squashed. |
Add Luhn validator for client-side validation of credit card numbers and other values (like SIRET) that must pass the Luhn algorithm.
The implementation follows Symfony's LuhnValidator.php logic: