项目作者: mathiasvr

项目描述 :
Validate and generate danish social security numbers (cpr-nummer)
高级语言: JavaScript
项目地址: git://github.com/mathiasvr/danish-ssn.git
创建时间: 2016-01-30T19:09:02Z
项目社区:https://github.com/mathiasvr/danish-ssn

开源协议:MIT License

下载


Danish SSN (CPR) npm

Validate and generate danish social security numbers (cpr-nummer)

install

  1. $ npm install danish-ssn

usage

Validation is based on modulo-11 and century spans described in this document (in danish).

  1. var cpr = require('danish-ssn')
  2. console.log(cpr('061093-7438'))

cpr(cpr)

Retrieve information contained by the cpr number,
in the following format:

  1. { cpr: '0610937438',
  2. valid: true,
  3. date: new Date('1893-10-06T00:00:00.000Z'),
  4. sex: 'Female' }

.isValid(cpr)

Returns whether or not the cpr number is valid*.

.validate(cpr)

Makes a cpr number valid by correcting the check digit.
Returns null if the cpr has no valid check digit.

.validForDate(date)

Generates a list of all valid* cpr numbers for a given date.

*Note that since 2007, CPR numbers with invalid check digits has been issued for birthdays on January 1.

license

MIT