Digit-only string (/^\d+$/); each char must be '0'..'9'.
The check digit in 0..9.
import { mod11_10CheckDigit } from "nationid/algorithms";
// DE USt-IdNr: 8-digit body
mod11_10CheckDigit("12345678"); // 8 → DE123456788
// HR OIB: 10-digit body
mod11_10CheckDigit("3339200596"); // 1 → HR33392005961
// DE Steuer-ID: 10-digit body (different length from USt-IdNr)
mod11_10CheckDigit("4703689281"); // 6 → 47036892816
Compute the ISO/IEC 7064 MOD 11,10 check digit for a body of decimal digits. The algorithm is length-generic — supply any positive-length digit string and the function returns the single check digit in
0..9that, when appended, makes the full string self-checking under the MOD 11,10 scheme.Sequence: starting from check
c = 10, for each body digitd:p = ((d + c) % 10) || 10, thenc = (p * 2) % 11. Final check digit is(11 - c) % 10.