This repository implements the Luhn algorithm to check for whether an input value is valid or invalid.
checkLuhn(input: string)
- Use the function to check the value
- It will return the following object:
{input: string, valid: boolean, remainder: number | null, messageL string}
checkLuhn("4054425307472577")
- This will give
{ "input": "4054425307472577", "valid": true, "message": "Number is valid", "remainder": 0 }
There is no length check to keep it open to general use, it will give invalid result if the string contains alphabetic characters
Author: Gurjinder Singh (@Github/Gurjinder7)