Skip to content

Documentation / @facturometro/validator / identifiers / gln

Function: gln() ​

gln(value): boolean

Defined in: packages/validator/src/identifiers/gln.ts:20

u:gln: the GS1 modulo-10 check digit of a Global Location Number (PEPPOL-COMMON-R040, scheme 0088).

Port of the Schematron function: the digits before the check digit are weighted 3, 1, 3, ... from the right, and (10 - sum mod 10) mod 10 must equal the check digit. The rule guards the call with matches(., '^[0-9]+$'); this port returns false for anything that is not all digits.

Parameters ​

value ​

string

The identifier, whitespace-normalized.

Returns ​

boolean

true when the check digit is right.

Example ​

ts
import { gln } from '@facturometro/validator';

gln('5901234123457'); // true
gln('5901234123456'); // false

MIT licensed. Specification artefacts belong to OpenPEPPOL, CEN and OASIS.