Documentation / @facturometro/validator / identifiers / luhnSe
Function: luhnSe() ​
luhnSe(
value):boolean
Defined in: packages/validator/src/identifiers/luhn-se.ts:20
u:checkSEOrgnr: the Luhn check digit of a Swedish organisation number (PEPPOL-COMMON-R049, scheme 0007; SE-R-013).
Port of the Schematron function: the first nine digits are weighted 2, 1, 2, ... from the right (a doubled digit above 9 has its digits added), and (10 - sum mod 10) mod 10 must equal the tenth digit. Input that is not all digits returns false, as upstream; input shorter than ten digits has no check digit and returns false too.
Parameters ​
value ​
string
The identifier, whitespace-normalized.
Returns ​
boolean
true when the check digit is right.
Example ​
ts
import { luhnSe } from '@facturometro/validator';
luhnSe('5560125790'); // true
luhnSe('5560125791'); // false