class-validator icon indicating copy to clipboard operation
class-validator copied to clipboard

isLuhn

Open arash-mosavi opened this issue 1 year ago • 1 comments

Description

This PR introduces the isLuhn decorator, which validates credit card numbers using the Luhn algorithm. This decorator can be applied to ensure that the provided card numbers are correctly formatted and valid according to the Luhn checksum.

Checklist

  • [x] the pull request targets the default branch of the repository (develop)
  • [x] the code follows the established code style of the repository
    • npm run prettier:check passes
    • npm run lint:check passes
  • [x] tests are added for the changes I made (if any source code was modified)
  • [x] documentation added or updated
  • [x] I have run the project locally and verified that there are no errors

arash-mosavi avatar Aug 30 '24 18:08 arash-mosavi

Instead of implementing the validation code here, we should use isLuhnNumber from validator.js

braaar avatar Jun 30 '25 09:06 braaar