fn
luhn
v0.0.1testedValidate a number string against the Luhn (mod 10) checksum — the
check digit used by payment cards, IMEIs, SIM ICCIDs, and more. Non-digits are
ignored; an empty input is false.
Example
ts
luhn('4111 1111 1111 1111'); // true
luhn('4111 1111 1111 1112'); // falseSignature
ts
export function luhn(value: string): boolean{ ... }Parameters
| Parameter | Type | Description |
|---|---|---|
value | string | The number (separators allowed) |
Returns
booleanWhether the Luhn checksum passes