Compute the Luhn check digit for a body of digits (without the check digit).
Returns the check digit (0-9) that, when appended, makes the full number
Luhn-valid. Useful for generating synthetic test data or for the trailing
digit on emitted document numbers.
Parameters
body: string
Digit-only string WITHOUT the check digit position.
Returns number
Integer in [0, 9] — the digit to append to make body Luhn-valid.
Compute the Luhn check digit for a body of digits (without the check digit).
Returns the check digit (0-9) that, when appended, makes the full number Luhn-valid. Useful for generating synthetic test data or for the trailing digit on emitted document numbers.