'Parser' pentru cod numeric personal (CNP)
npm install parsecnpA parser for C.N.P. (short for _C_od _N_umeric _P_ersonal or _Personal Identification Number_).
C.N.P. is a 13 digit unique number assigned to Romanian people at birth and to residents.
Using npm:
``terminal`
npm install parsecnp --save
Using Yarn
`terminal`
yarn add parsecnp
In a browser
`html`
The package exports ParseCNP as a global.
`js`
// using new
const cnp = new ParseCNP(1700101123456);
// using factory
ParseCNP(1700101123456);
`js
const cnp = new ParseCNP(1700101123456);
cnp.sex; // => "male" (string)
cnp.birthdate; // => Thu Jan 01 1970 00:00:00 GMT+0200 (Date)
cnp.year; // => 1970 (number)
cnp.month; // => 1 (number)
cnp.day; // => 1 (number)
cnp.county.name; // => "Cluj" (string)
cnp.county.ISO; // => "CJ" (string)
cnp.county.code; // => 12 (number)
cnp.serial; // => "345" (string)
cnp.checksum; // => "6" (string)
cnp.isValid; // => false (boolean)
cnp.toString(); // => "1700101123456" (string)
cnp.toJSON(); // => (string)
``