Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

norwegian-national-id-validator

Package Overview
Dependencies
Maintainers
2
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

norwegian-national-id-validator

Validate norwegian national identity numbers

  • 1.3.8
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
7.7K
decreased by-0.93%
Maintainers
2
Weekly downloads
 
Created
Source

norwegian-national-id-validator

Travis build status npm

Validate Norwegian national identity numbers (birth number (fødselsnummer), D-number, H-number and FH-number).

The NPM module is ES5, but TypeScript and Flow types is also exported. Types for Flow is generated with Flowgen.

Installation

Install the package via npm:

npm install --save norwegian-national-id-validator

or

yarn add norwegian-national-id-validator

Usage

validateNorwegianIdNumber(value)

This function checks if the given value is a valid Norwegian national identity number. Returns true for valid, and false for invalid ID-number.

Examples

import { validateNorwegianIdNumber } from 'norwegian-national-id-validator'

validateNorwegianIdNumber('29029900157')
// => false

validateNorwegianIdNumber('29029600013')
// => true

possibleAgeOfPersonWithIdNumber(value)

This function returns the age of a person with given Norwegian national identity number.

Returns undefined when birth date could not be determined (e.g. for FH-numbers and invalid ID-numbers).

Examples


import { possibleAgeOfPersonWithIdNumber } from 'norwegian-national-id-validator'

possibleAgeOfPersonWithIdNumber('03111590925')
// => 1

possibleAgeOfPersonWithIdNumber('03110175225')
// => 15

Tests

To run the tests for this module:

npm test

License

MIT

Keywords

FAQs

Package last updated on 14 Mar 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc