1.0.14 • Published 3 years ago

@deploythenscotch/national-id-validator v1.0.14

Weekly downloads
2
License
MIT
Repository
github
Last release
3 years ago

npm.io npm.io npm.io npm.io

National Id

Allows you to both validate and create mock national IDs.

Installation

yarn add @deploythenscotch/national-id-validator

or

npm install @deploythenscotch/national-id-validator

Usage

ES5

const nationalID = require('@deploythenscotch/national-id-validator');
const isValidID = nationalID.isValid('18100749331');

ES2016+

import nationalID from @deploythenscotch/national-id-validator;
const isValidID = nationalID.isValid('18100749331');

Methods

import nationalID from @deploythenscotch/national-id-validator;

// Check if the ID is valid. Works with both "fødselsnummer" and "d-nummer".
// Returns true || false.
nationalID.isValid('18100749331'); // true;

// Get the type based on the ID.
// Returns 'FNUMBER' || 'DNUMBER'
nationalID.getTypeFromID('18100749331'); // 'FNUMBER'

// Get the gender based on the ID.
// Returns 'MALE' OR 'FEMALE'
nationalID.getGenderFromID('18100749331'); // 'MALE'

// Get the date from ID. Will return a native date object.
// Returns Date object
nationalID.getDateFromID('18100749331'); // Fri Oct 18 1907 01:00:00 GMT+0100
1.0.10-beta.0

3 years ago

1.0.4-beta.0

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3-0

3 years ago

1.0.3

3 years ago

1.0.2-0

3 years ago

1.0.8-beta.0

3 years ago

1.0.9-beta.0

3 years ago

1.0.5-beta.0

3 years ago

1.0.14

3 years ago

1.0.1

4 years ago

1.0.0

4 years ago