npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

js-romanian-cnp-validation

v1.0.0

Published

A CNP (Cod Numeric Personal) is a personal identification number used in Romania. It's a unique code assigned to each Romanian citizen and is similar to a national identification number or social security number in other countries. CNP consists of 13 digi

Downloads

2

Readme

js-valid-cnp

Function for replace all ocurence of a string for NodeJS versions older than 15

Usage

Personal number code (Romania) - C.N.P.

In Romania, the assignment of C.N.P. (personal number code) it is done by the community public services for records of persons or, where they do not exist or do not function, by the executive authorities of the administrative-territorial units, and abroad, the assignment of C.N.P. it is done by the Ministry of Foreign Affairs, through the diplomatic missions and consular offices of Romania.

Residents receive C.N.P. from the General Inspectorate for Immigration and is written in the residence permit. Change

A new C.N.P. it is attributed to the same person in one of the following situations[4]:

the birth certificate was rectified, the data included in the C.N.P structure being modified.
the column in the birth certificate in which the C.N.P. is entered. was filled in incorrectly
C.N.P. was misattributed
the applicant has changed gender
there are inconsistencies regarding C.N.P.

Structure

The personal numerical code consists of 13 digits[1], unique for each natural person and consists of 7 components:

SAALLZZJJNNNC

This string of 13 digits is divided into S AA LL ZZ JJ NNN C

S

The S component represents the sex and the century in which the person was born and can have one of the following values[5]:

1 for males born between 1900 and 1999
2 for female persons born between 1900 and 1999
3 for males born between 1800 and 1899
4 for female persons born between 1800 and 1899
5 for males born between 2000 and 2099
6 for female persons born between 2000 and 2099
7 for male residents[6]
8 for female residents[6]

AA

The AA component consists of the last 2 digits of the year of birth[7]. LL

The LL component consists of the month of birth, with values ​​between 01 and 12[7].

ZZ

The ZZ component consists of the day of birth, with values ​​between 01 and 28, 29, 30 or 31, as appropriate[7].

JJ

The JJ component represents the county or sector where the person was born, or where he had his domicile or residence at the time of granting the C.N.P.[8], according to the SIRUTA nomenclature.

County codes are in their alphabetical order, with some exceptions. County Code 01 White 02 Arad 03 Arges 04 Bacau 05 Bihor 06 Bistrita-Năsăud 07 Botosani 08 Brasov 09 Braila 10 Buzau 11 Caraș-Severin 12 Cluj 13 Constanta 14 Covasna 15 Dâmbovița 16 Dolj 17 Galatians 18 Gorj 19 Harghita 20 Hunedoara 21 Ialomita 22 Iasi 23 Ilfov 24 Maramureș 25 Mehedints 26 Mures 27 German 28 Olt 29 Prahova 30 Satu Mare 31 Salaj 32 Sibiu 33 Suceava 34 Teleorman 35 Timis 36 Tulcea 37 Vaslui 38 Valcea 39 Vrancea 40 Bucharest 41 Bucharest - District 1 42 Bucharest - Sector 2 43 Bucharest - District 3 44 Bucharest - District 4 45 Bucharest - Sector 5 46 Bucharest - District 6 51 Calarași 52 Giurgiu 47 Bucharest - Sector 7 (abolished) 48 Bucharest - District 8 (abolished)

NNN

The NNN component represents a sequential number (between 001 and 999), distributed by assignment points, which differentiates people of the same sex, born in the same place and with the same date of birth[9].

C

Component C consists of a check digit, which allows detecting possible errors of replacement or inversion of the digits in the C.N.P. component [10] Validation

Validation of a C.N.P. consists of calculating the component C and comparing it with the received value of the same component. If they are identical, it means that C.N.P. checked is valid.

The calculation of the C component is done using the constant "279146358279", as follows:

each digit of the first 12 digits of the C.N.P. is multiplied by its constant counterpart
the results are summed and the total is divided by 11
if the remainder of the division is less than 10, that represents the value of the C component
if the remainder of the division is 10, the value of the C component is 1

the source of the explanations https://ro.wikipedia.org/wiki/Cod_numeric_personal_(România)

const validcnp= require("js-cnp-validation");
validcnp.validcnp("1721004437817");
  // Output: true
const validcnp= require("js-valid-cnp");
validcnp.validcnp("1721004437818");
  // Output: false