Module: norwegian-numbers

Make and verify official Norwegian numbers like: KID-nummer, organisasjonsnummer, fødselsnummer, kontonummer
Source:

Methods

(inner) makeAccountNumber(value) → {string}

Makes an account number. Valid input length is 10 characters. The output length will be 11 character.
Parameters:
Name Type Description
value string The value to make the account number based on
Source:
Throws:
Error If invalid length, non-integer or illegal control digits
Returns:
The resulting account number
Type
string

(inner) makeBirthNumber(value) → {string}

Makes a birth number. Valid input length is 9 characters. The output length will be 11 character.
Parameters:
Name Type Description
value string The value to make the birth number based on
Source:
Throws:
Error If invalid length, non-integer or illegal control digits
Returns:
The resulting birth number
Type
string

(inner) makeKidNumber(value, mode) → {string}

Makes a KID-number in either MOD10 or MOD11. Valid input lengths are from 1 to 24 characters, inclusive. The output length will be one character longer.
Parameters:
Name Type Description
value string The value to make the KID-number based on
mode string MOD10 (default) or MOD11
Source:
Throws:
Error If invalid length, non-integer or invalid mode
Returns:
The resulting KID-number
Type
string

(inner) makeOrganisationNumber(value) → {string}

Makes an organisation number. Valid input length is 8 characters. The output length will be 9 character.
Parameters:
Name Type Description
value string The value to make the organisation number based on
Source:
Throws:
Error If invalid length, non-integer or illegal control digits
Returns:
The resulting organisation number
Type
string

(inner) verifyAccountNumber(value) → {boolean}

Verifies an account number.
Parameters:
Name Type Description
value string The account number value to verify
Source:
Returns:
If the value is a valid account number or not
Type
boolean

(inner) verifyBirthNumber(value) → {boolean}

Verifies a birth number.
Parameters:
Name Type Description
value string The birth number value to verify
Source:
Returns:
If the value is a valid birth number or not
Type
boolean

(inner) verifyKidNumber(value, mode) → {boolean}

Verifies a KID-number in either MOD10 or MOD11.
Parameters:
Name Type Description
value string The KID-number value to verify
mode string MOD10 (default) or MOD11
Source:
Returns:
If the value is a valid KID-number or not
Type
boolean

(inner) verifyOrganisationNumber(value) → {boolean}

Verifies an organisation number.
Parameters:
Name Type Description
value string The organisation number value to verify
Source:
Returns:
If the value is a valid organisation number or not
Type
boolean