1.2.0 • Published 2 years ago

cnp-decoder v1.2.0

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

CNP Decoder

A tiny and simple library that can decode a romanian CNP, extracting informations like the gender, age, the county where the user was born.

Installation

  npm install cnp-decoder

Usage

    import { decodeCNP } from 'cnp-decoder'

    const cnpData = decodeCNP(cnp)
    // or you can destructure the values
    const { gender, birthDate, age, county, isResident } = decodeCNP(cnp)

Result

PropertyTypeDescription
genderstringIt returns the gender of the CNP holder
birthDateDateIt returns a Javascript date containing the date the holder was born
agenumberIt returns the age of the holder as a number
countystringIt returns the county the holder lives in
isResidentbooleanIt returns true\false depending if the user is a immigrant in Romania or not
1.2.0

2 years ago

1.1.0

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago