Skip to content

Latest commit

 

History

History
78 lines (52 loc) · 2.53 KB

README.md

File metadata and controls

78 lines (52 loc) · 2.53 KB

Norwegian numbers

NPM Build Status Coverage Status License

Make and verify official Norwegian numbers:

  • KID-nummer: makeKidNumber(value, mode = 'MOD10') and verifyKidNumber(value, mode = 'MOD10')
  • Organisasjonsnummer: makeOrganisationNumber(value) and verifyOrganisationNumber(value)
  • Fødselsnummer: makeBirthNumber(value) and verifyBirthNumber(value)
  • Kontonummer: makeAccountNumber(value) and verifyAccountNumber(value)

This currently only concerns itself with the control digits.

Installation

To install from NPM as a package in your environment:

npm install norwegian-numbers

Code usage from installation

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'

Testing from source

To run the tests:

mocha

Or:

npm test

Distribution

The distribution was created by the following commands:

npm publish --access public

Changes

1.0.9

  • Added TypeScript declaration
  • Added code coverage metrics and additional tests

1.0.7

  • Added JSDoc

Notes

Mainly made as a TypeScript NPM package test bed. Check out these packages: