typestack / class-validator

Decorator-based property validation for classes.
MIT License
10.92k stars 787 forks source link

feature: Luhn algorithm #2519

Open mr-arashmousavi opened 1 month ago

mr-arashmousavi commented 1 month ago

Description

I have implemented the Luhn algorithm for validating card numbers in the project. This algorithm, widely used to verify the validity of credit card numbers, has been added to the project to prevent invalid card numbers from being accepted.

Proposed solution

Adding the Luhn Algorithm: A function named isLuhn has been created that uses the Luhn algorithm to validate card numbers. This function ensures that only valid card numbers are accepted.

Writing Tests: Tests have been written to ensure the correct functionality of this algorithm. These tests cover various scenarios, including valid and invalid card numbers, to verify that the algorithm works as expected.

Would it be possible for me to create a Pull Request for these changes? Please let me know if I can proceed with submitting the PR.