Documentation / @facturometro/einvoice / identifiers / mod11
Function: mod11() ​
mod11(
value):boolean
Defined in: packages/validator/src/identifiers/mod11.ts:20
u:mod11: the modulo-11 check digit of a Norwegian organisation number (PEPPOL-COMMON-R041, scheme 0192; NO-R-001).
Port of the Schematron function: the digits before the check digit are weighted 2, 3, 4, 5, 6, 7, 2, 3, ... from the right, (11 - sum mod 11) mod 11 must equal the check digit, and the number must be greater than zero. A remainder that would need a check digit of 10 can never match, exactly as upstream. Non-digit input returns false (number() would be NaN).
Parameters ​
value ​
string
The identifier, whitespace-normalized.
Returns ​
boolean
true when the check digit is right.
Example ​
ts
import { mod11 } from '@facturometro/validator';
mod11('987654325'); // true
mod11('987654321'); // false