Make and verify official Norwegian numbers:
- KID-nummer:
makeKidNumber(value, mode = 'MOD10')
andverifyKidNumber(value, mode = 'MOD10')
- Organisasjonsnummer:
makeOrganisationNumber(value)
andverifyOrganisationNumber(value)
- Fødselsnummer:
makeBirthNumber(value)
andverifyBirthNumber(value)
- Kontonummer:
makeAccountNumber(value)
andverifyAccountNumber(value)
This currently only concerns itself with the control digits.
To install from NPM as a package in your environment:
npm install norwegian-numbers
Example code usages after installation:
> const nn = require('norwegian-numbers');
undefined
> nn
{ makeKidNumber: [Function: makeKidNumber],
verifyKidNumber: [Function: verifyKidNumber],
makeBirthNumber: [Function: makeBirthNumber],
verifyBirthNumber: [Function: verifyBirthNumber],
makeAccountNumber: [Function: makeAccountNumber],
verifyAccountNumber: [Function: verifyAccountNumber],
makeOrganisationNumber: [Function: makeOrganisationNumber],
verifyOrganisationNumber: [Function: verifyOrganisationNumber] }
> nn.makeKidNumber('1234');
'12344'
> nn.makeKidNumber('1234', 'MOD11');
'12343'
> nn.makeBirthNumber('311299567');
'31129956715'
> nn.makeAccountNumber('1234567890');
'12345678903'
> nn.makeOrganisationNumber('12345678');
'123456785'
To run the tests:
mocha
Or:
npm test
The distribution was created by the following commands:
npm publish --access public
- Added TypeScript declaration
- Added code coverage metrics and additional tests
- Added JSDoc
Mainly made as a TypeScript NPM package test bed. Check out these packages: