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

@holczhabyt/codice-fiscale-utils

v2.2.3

Published

TS & JS utilities to handle Italian Codice Fiscale

Downloads

3,349

Readme

codice-fiscale-utils

The Final and definitive solution to handle the Italian Tax Code

This is a fork of the original package that is using date-fns instead of the moment.js for handling dates.

NPM Version NPM Downloads LICENSE Read the Blog of the original author Buy a coffee to the original author

TS utilities to handle Italian Codice Fiscale

📗 FAQs?

  1. Why should I need a library? Can't I use just a RegExp? A RegExp would just check the form of a CodiceFiscale, not coherence between birth date and place, not validity of 16th check digit char

  2. What about the omocodes (Omocodia/Omocodice) problem, does it work? Absolutely! There's a dedicated class to encode or decode such kind of CodiceFiscale and it's properly integrated in Parser, Validator and Pattern methods

  3. Why it's ~240KB? Seems a lot It contains all you need in a FE or BE environment to properly check and validate a CodiceFiscale by its own or against spare personal informations, the full list of all Italian cities and foregin countries since 1861 including belfiore codes, province for cities, begin and end date

  4. Should I trust such city/country informations and do I need them? Sure, every single information is provided with original source referrals like website, license and name. The script used to create the embedded dataset uses only official informations provided by Italian istitutional sources under CC-BY like 'Agenzia delle entrate', 'Ministero dell'interno' or 'ISTAT'; Give a look at the Assets Licenses and Authors chapters

  5. Can I use this library in a FE project with other frameworks? Sure, it's built to work both in node and browser environments! Give a look at the Demo section

📙 CHANGELOG

🚃 ROADMAP

🔌 INSTALLATION

npm i -s @habyt/codice-fiscale-utils

🔧 USAGE

NodeJs

const CodiceFiscaleUtils = require('@habyt/codice-fiscale-utils');

ES6

import CodiceFiscaleUtils from '@habyt/codice-fiscale-utils';

TypeScript

import * as CodiceFiscaleUtils from '@habyt/codice-fiscale-utils';

Client Side Script

Note: date-fns is increadibly small, but as it supports treeshaking you can just load the neccessary modules (I will crate a list here soon.)

<script src="https://cdn.jsdelivr.net/npm/[email protected]/index.min.js"></script>
<script src="https://unpkg.com/@habyt/diacritic-remover/dist/diacritic-remover.bundle.min.js"></script>
<script src="https://unpkg.com/@habyt/codice-fiscale-utils/dist/codice-fiscale-utils.bundle.min.js"></script>

💻 DEMO

As this fork does not change the functionality, you can use the original Demo (make sure to buy a coffee to Marketto)

NodeJS Express

VueJs

Angular

📖 DOCUMENTATION

JsDocs @ GitHub Pages

Parser

Class with static methods

const { Parser } = CodiceFiscaleUtils;

Parser.cfDeomocode

Parser.cfDeomocode("KKALMNVMAPLB331Z"); //KKALMN91A30B331P
Parser.cfDeomocode("kkalmnvmaplb331z"); //kkalmn91a30b331p

Parser.cfOmocodeId

Parser.cfOmocodeId("VRNGNYLtdsucprmt"); //127
Parser.cfOmocodeId("kkalmn91as0b331z"); //16
Parser.cfOmocodeId("kkalmn91a30b331z"); //0

Parser.cfOmocode

Parser.cfOmocode("VRNGNY07d68c351v", 0); //VRNGNY07d68c351v
Parser.cfOmocode("VRNGNY07d68c351v", 1); //VRNGNY07d68c35Mn
Parser.cfOmocode("VRNGNY07d68c351v", 2); //VRNGNY07d68c3R1h
Parser.cfOmocode("VRNGNY07d68c351v", 3); //VRNGNY07d68c3RMz
Parser.cfOmocode("VRNGNY07d68c351v", 8); //VRNGNY07d6Uc351s
Parser.cfOmocode("VRNGNY07d68c351v", 32); //VRNGNY0Td68c351h
Parser.cfOmocode("VRNGNY07d68c351v", 127); //VRNGNYLTdSUcPRMt
//Re-omocode
Parser.cfOmocode("kkalmnvmaplb331z", 0); //kkalmn91a30b331p
Parser.cfOmocode("kkalmnvmaplb331z", 1); //kkalmn91a30b33Mh
Parser.cfOmocode("kkalmnvmaplb331z", 74); //kkalmnv1a3lb3P1t
Parser.cfOmocode("kkalmnvmaplb331z", 127); //kkalmnvmaplbPPMe

Parser.cfToLastName

Parser.cfToLastName('WYZ'); //W*Y*Z*

Parser.cfToFirstName

Parser.cfToFirstName('ZZZWAE'); //WAE*

Parser.cfToGender

Parser.cfToGender('XXXYYY90B20'); //M
Parser.cfToGender('XXXYYY90B63'); //F

Parser.cfToBirthDay

Parser.cfToBirthDay('XXXYYY90B71'); //31

Parser.cfToBirthMonth

Parser.cfToBirthMonth('XXXYYY92C'); //2

Parser.cfToBirthYear

Parser will consider dates that can be both 19xx and 20xx as 20xx if they would be valid in the last 100 years range from now

Parser.cfToBirthYear('XXXYYY92'); //1992
Parser.cfToBirthYear('XXXYYY12'); //2012

Parser.cfToBirthDate

const dt = Parser.cfToBirthDate('XXXYYY81A63'); //Date
dt.toJSON(); //1981-01-23T...

Parser.cfToBirthPlace

const birthPlace = Parser.cfToBirthPlace('XXXYYY92B20H501');
/*
{
    firstName: "ROMA",
    belfioreCode: "H501",
    creationDate: Date("1884-09-10T22:00:00.000Z"),
    expirationDate: Date("9999-12-31T22:59:59.999Z"),
    province: "RM",
    dataSource: {
        "name": "Ministero dell\'Interno",
        "url": "https://developers.italia.it/en/anpr",
        "license": "cc-by-4.0",
        "licenseUrl": "https://creativecommons.org/licenses/by/4.0/legalcode.it",
        "termsAndConditions": "https://github.com/italia/anpr/blob/master/src/archivi/ANPR_archivio_comuni_legenda.md",
        "authors": "https://github.com/italia/anpr/blob/master/AUTHORS"
    }
}
*/

Parser.cfDecode

Parser.cfDecode('VRNGNY07D68C351V');
/*
{
    lastName: 'V*R*N*',
    firstName: 'G*N*Y*',
    day: 28,
    month: 3,
    year: 2017,
    gender: 'F',
    place: 'CATANIA'
}
*/

Parser.lastNameToCf

Parser.lastNameToCf('Rossi'); //RSS
Parser.lastNameToCf('Réno'); //RNE
Parser.lastNameToCf('Aieie'); //AIE

Parser.firstNameToCf

Parser.firstNameToCf('Dòminique'); //DNQ
Parser.firstNameToCf('Mark'); //MRK
Parser.firstNameToCf('Tom'); //TMO
Parser.firstNameToCf('Ania'); //NAI

Parser.yearToCf

Parser.yearToCf('1990'); //90
Parser.yearToCf(2010); //10
Parser.yearToCf('02'); //02

Parser.monthToCf

Parser.monthToCf(0); //A
Parser.monthToCf(4); //E
Parser.monthToCf(8); //P

Parser.monthToCf

Parser.monthToCf(0); //A
Parser.monthToCf(4); //E
Parser.monthToCf(8); //P

Parser.dayGenderToCf

Parser.dayGenderToCf(3, 'M'); //03
Parser.dayGenderToCf(7, 'F'); //47

Parser.dateGenderToCf

Parser.dateGenderToCf([2016, 3, 23], 'M'); //16D23
Parser.dateGenderToCf('1987-09-22', 'F'); //87P62
Parser.dateGenderToCf(new Date(2016, 2, 23, 12), 'M'); //16C23
Parser.dateGenderToCf(new Date(1988, 7, 3, 12), 'F'); //88M43

Parser.placeToCf

Parser.placeToCf('Bologna');
/*
{
    belfioreCode: 'A944',
    firstName: 'BOLOGNA',
    creationDate: 1861-03-16T23:00:00.000Z,
    expirationDate: 9999-12-31T22:59:59.999Z,
    dataSource: {...},
    province: 'BO'
}
*/
Parser.placeToCf([1990],'Unione Sovietica');
/*
{
    belfioreCode: 'Z135',
    firstName: 'Unione Sovietica',
    creationDate: 1860-12-31T23:00:00.000Z,
    expirationDate: 1991-12-31T22:59:59.999Z,
    dataSource: {...},
    iso3166: 'SU'
}
*/
Parser.placeToCf([2000],'Unione Sovietica'); //null

Parser.encodeCf

Parser.encodeCf({
    lastName: 'Veronesi',
    firstName: 'Genny',
    year: 1907,
    month: 3,
    day: 28,
    gender: 'F',
    place: 'Catania'
}); //VRNGNY07D68C351V

Pattern

Class with static methods

const { Pattern } = CodiceFiscaleUtils;

Pattern.cfLastName

Pattern.cfLastName().test('KST'); //true
Pattern.cfLastName().test('AST'); //false
Pattern.cfLastName('Alex').test('KST'); //false
Pattern.cfLastName('Alex').test('LXA'); //true

Pattern.cfFirstName

Pattern.cfFirstName().test('NIX'); //true
Pattern.cfFirstName().test('UIK'); //false
Pattern.cfFirstName('Dominique').test('DMN'); //false
Pattern.cfFirstName('Dominique').test('DNQ'); //true

Pattern.cfYear

Pattern.cfYear().test('07'); //true
Pattern.cfYear().test('3'); //false
Pattern.cfYear(1907).test('07'); //true
Pattern.cfYear(1986).test('U6'); //true - omocode
Pattern.cfYear(1986).test('87'); //false

Pattern.cfMonth

Pattern.cfMonth().test('C'); //true
Pattern.cfMonth().test('Z'); //false
Pattern.cfMonth(3).test('D'); //true
Pattern.cfMonth(3).test('A'); //false

Pattern.cfDay

Pattern.cfDay().test('0M'); //true - omocode
Pattern.cfDay().test('33'); //false
Pattern.cfDay(12).test('12'); //true - male
Pattern.cfDay(12).test('52'); //true - female
Pattern.cfDay(12).test('MN'); //true - omocode
Pattern.cfDay(12).test('22'); //false

Pattern.cfDayGender

Pattern.cfDayGender().test('0M'); //true
Pattern.cfDayGender().test('73'); //false
Pattern.cfDayGender(9, 'F').test('RM'); //true
Pattern.cfDayGender(1, 'F').test('41'); //true
Pattern.cfDayGender(1, 'M').test('41'); //false

Pattern.cfDateGender

Pattern.cfDateGender().test('83D22'); //true
Pattern.cfDateGender().test('83Z32'); //false
Pattern.cfDateGender([1983, 3, 22], 'M').test('U3D2N'); //true
Pattern.cfDateGender("1995-05-01", 'F').test('V5EQ1'); //true
Pattern.cfDateGender([1983, 3, 22], 'M').test('83D62'); //false

Pattern.cfPlace

Pattern.cfPlace().test('A662'); //true
Pattern.cfPlace().test('Z974'); //false
Pattern.cfPlace('Bari').test('H501'); //true
Pattern.cfPlace([1933], 'Fiume').test('D620'); //true
Pattern.cfPlace([2000], 'Fiume').test('D620'); //false - Always invalid

Pattern.codiceFiscale

Pattern.codiceFiscale().test('VRNGNY07D68C351V'); //true
Pattern.codiceFiscale().test('MRNMIA02E45L2193'); //false
//Partial info
Pattern.codiceFiscale({
    lastName: 'Veronesi',
    firstName: 'Genny',
    gender: 'F',
    place: 'Catania'
}).test('VRNGNY97A65C351V'); //true
//Full info
Pattern.codiceFiscale({
    lastName: 'Veronesi',
    firstName: 'Genny',
    year: 1907,
    month: 3,
    day: 28,
    gender: 'F',
    place: 'Catania'
}).test('VRNGNY07D68C351V'); //true

Pattern.lastName

Pattern.lastName().test('Kristersen'); //true
Pattern.lastName('VLD').test('Vàlidàtòr'); //true
Pattern.lastName('AIX').test('Air'); //false

Pattern.firstName

Pattern.firstName().test('Rossi'); //true
Pattern.firstName('XYZAIE').test('Aieie'); //true
Pattern.firstName('XYZAIX').test('Air'); //false

Pattern.date

Pattern.date().test('1995'); //true
Pattern.date().test('1985-01'); //true
Pattern.date().test('1970-03-03'); //true
Pattern.date().test('1970-03-'); //false
Pattern.date('XYZXYZ88H61').test('1988-06-21'); //true
Pattern.date('XYZXYZ92C16').test('1992-03-26'); //false

Pattern.gender

Pattern.gender().test('F'); //true
Pattern.gender().test('X'); //false
Pattern.gender('XYZXYZ88H61').test('F'); //true
Pattern.gender('XYZXYZ88H61').test('M'); //false

Pattern.place

Pattern.place().test('Roma'); //true
Pattern.place('XYZXYZ92C16A662').test('Bari'); //true
Pattern.place('XYZXYZ12S30A662').test('Bologna'); //false

Validator

Class with static methods

const { Validator } = CodiceFiscaleUtils;

isLastNameValid

Validator.isLastNameValid("Test"); //true
Validator.isLastNameValid("Tést N'àme"); //true
Validator.isLastNameValid(""); //false
Validator.isLastNameValid("@!#"); //false

isLastNameInvalid

Validator.isLastNameInvalid("Test"); //false
Validator.isLastNameInvalid("Tést N'àme"); //false
Validator.isLastNameInvalid(""); //false
Validator.isLastNameInvalid("@!#"); //true

isFirstNameValid

Validator.isFirstNameValid("Test"); //true
Validator.isFirstNameValid("Tést N'àme"); //true
Validator.isFirstNameValid(""); //false
Validator.isFirstNameValid("@!#"); //false

isFirstNameInvalid

Validator.isFirstNameInvalid("Test"); //false
Validator.isFirstNameInvalid("Tést N'àme"); //false
Validator.isFirstNameInvalid(""); //false
Validator.isFirstNameInvalid("@!#"); //true

isBirthDateValid

Validator.isBirthDateValid("1999-01-01"); //true
Validator.isBirthDateValid([1999, 0, 1]); //true
Validator.isBirthDateValid(""); //false
Validator.isBirthDateValid("2000-02-30"); //false
Validator.isBirthDateValid("No date"); //false
Validator.isBirthDateValid("@!#"); //false

isBirthDateInvalid

Validator.isBirthDateInvalid("1999-01-01"); //false
Validator.isBirthDateInvalid([1999, 0, 1]); //false
Validator.isBirthDateInvalid(""); //false
Validator.isBirthDateInvalid("2000-02-30"); //true
Validator.isBirthDateInvalid("No date"); //true
Validator.isBirthDateInvalid("@!#"); //true

isBirthPlaceValid

Validator.isBirthPlaceValid("Roma"); //true
Validator.isBirthPlaceValid("H501"); //true
Validator.isBirthPlaceValid(""); //false
Validator.isBirthPlaceValid("Moon"); //false
//With scoped BelfioreConnector
//By places active at the given date
Validator.isBirthPlaceValid("Unione sovietica", Belfiore.active()); //false
Validator.isBirthPlaceValid("Federazione Russa", Belfiore.active()); //true
Validator.isBirthPlaceValid("Unione sovietica", Belfiore.active([1980])); //true
Validator.isBirthPlaceValid("Federazione Russa", Belfiore.active([1980])); //false
//By places active from a given date
Validator.isBirthPlaceValid("Unione sovietica", Belfiore.from()); //false
Validator.isBirthPlaceValid("Federazione Russa", Belfiore.from()); //true
Validator.isBirthPlaceValid("Unione sovietica", Belfiore.from([1980])); //true
Validator.isBirthPlaceValid("Federazione Russa", Belfiore.from([1980])); //true
//By cities
Validator.isBirthPlaceValid("Francia", Belfiore.cities); //false
Validator.isBirthPlaceValid("A662", Belfiore.cities) //true
//By countries
Validator.isBirthPlaceValid("Belgio", Belfiore.countries); //true
//By province
Validator.isBirthPlaceValid("Vibo Valentia", Belfiore.byProvince("VV")); //true
Validator.isBirthPlaceValid("H501", Belfiore.byProvince("VV")); //false

isBirthPlaceInvalid

Validator.isBirthPlaceInvalid("Roma"); //false
Validator.isBirthPlaceInvalid("H501"); //false
Validator.isBirthPlaceInvalid(""); //false
Validator.isBirthPlaceInvalid("Moon"); //true
//With scoped BelfioreConnector
//By places active at the given date
Validator.isBirthPlaceInvalid("Unione sovietica", Belfiore.active()); //true
Validator.isBirthPlaceInvalid("Federazione Russa", Belfiore.active()); //false
Validator.isBirthPlaceInvalid("Unione sovietica", Belfiore.active([1980])); //false
Validator.isBirthPlaceInvalid("Federazione Russa", Belfiore.active([1980])); //true
//By places active from a given date
Validator.isBirthPlaceInvalid("Unione sovietica", Belfiore.from()); //true
Validator.isBirthPlaceInvalid("Federazione Russa", Belfiore.from()); //false
Validator.isBirthPlaceInvalid("Unione sovietica", Belfiore.from([1980])); //false
Validator.isBirthPlaceInvalid("Federazione Russa", Belfiore.from([1980])); //false
//By cities
Validator.isBirthPlaceInvalid("Francia", Belfiore.cities); //true
Validator.isBirthPlaceInvalid("A662", Belfiore.cities); //false
//By countries
Validator.isBirthPlaceInvalid("Belgio", Belfiore.countries); //false
//By province
Validator.isBirthPlaceInvalid("Vibo Valentia", Belfiore.byProvince("VV")); //false
Validator.isBirthPlaceInvalid("H501", Belfiore.byProvince("VV")); //true

birthDatePlaceMatch

Validator.birthDatePlaceMatch("1990-05-21", "Repubblica Socialista Federale di Jugoslavia"); //true
Validator.birthDatePlaceMatch(new Date(), "Repubblica Socialista Federale di Jugoslavia"); //false
Validator.birthDatePlaceMatch("1988-03-11", "Roma"); //true
Validator.birthDatePlaceMatch(new Date(), "Roma"); //true
Validator.birthDatePlaceMatch(new Date(), ""); //false
Validator.birthDatePlaceMatch("", "Palermo"); //false
Validator.birthDatePlaceMatch("", ""); //false

birthDatePlaceMismatch

Validator.birthDatePlaceMismatch("1990-05-21", "Repubblica Socialista Federale di Jugoslavia"); //false
Validator.birthDatePlaceMismatch(new Date(), "Repubblica Socialista Federale di Jugoslavia"); //true
Validator.birthDatePlaceMismatch("1988-03-11", "Roma"); //false
Validator.birthDatePlaceMismatch(new Date(), "Roma"); //false
Validator.birthDatePlaceMismatch(new Date(), ""); //false
Validator.birthDatePlaceMismatch("", "Palermo"); //false
Validator.birthDatePlaceMismatch("", ""); //false

matchPersonalInfo

Validator.codiceFiscale("VRNGNY07D68C351V")
    .matchPersonalInfo({
        day: 28,
        firstName: "Génny",
        gender: "F",
        lastName: "Verònesi",
        month: 3,
        place: "Catania",
        year: 1907,
    }); //true

Validator.codiceFiscale("VRNGNY07D68C351V")
    .mismatchPersonalInfo({
        day: 28,
        firstName: "Génny",
        gender: "F",
        lastName: "Verònesi",
        month: 3,
        place: "Firenze",
        year: 1907,
    }); //false

mismatchPersonalInfo

Validator.codiceFiscale("VRNGNY07D68C351V")
    .mismatchPersonalInfo({
        day: 28,
        firstName: "Génny",
        gender: "F",
        lastName: "Verònesi",
        month: 3,
        place: "Catania",
        year: 1907,
    }); //false

Validator.codiceFiscale("VRNGNY07D68C351V")
    .mismatchPersonalInfo({
        day: 28,
        firstName: "Génny",
    }); //false

codiceFiscale (CFMismatchValidator)

Class instance

Validator.codiceFiscale("VRNGNY07D68C351V"); //CFMismatchValidator

valid

Validator.codiceFiscale("VRNGNY07D68C351V").valid //true
Validator.codiceFiscale("MRNMIA02E45L219X").valid //true
Validator.codiceFiscale("GSTPPP31C06D620Z").valid //true
Validator.codiceFiscale("VRNGNY07D68C351K").valid //false - invalid check digit
Validator.codiceFiscale("GSTPPP99C06D620V").valid //false - invalid birth date/place
Validator.codiceFiscale("").valid; //false - empty cf

invalid

Validator.codiceFiscale("VRNGNY07D68C351V").invalid //false - OK
Validator.codiceFiscale("MRNMIA02E45L219X").invalid //false - OK
Validator.codiceFiscale("GSTPPP31C06D620Z").invalid //false - OK
Validator.codiceFiscale("VRNGNY07D68C351K").invalid //true - invalid check digit
Validator.codiceFiscale("GSTPPP99C06D620V").invalid //true - invalid birth date/place
Validator.codiceFiscale("").invalid //false - empty cf is not invalid!

matchLastName

Validator.codiceFiscale("VRNGNY07D68C351V").matchLastName("Vareni"); //true
Validator.codiceFiscale("VRN").matchLastName("Vareni"); //true
Validator.codiceFiscale("").matchLastName("Vareni"); //false
Validator.codiceFiscale("VRNGNY07D68C351V").matchLastName("John"); //false
Validator.codiceFiscale("VRNGNY07D68C351V").matchLastName("V"); //false
Validator.codiceFiscale("VRNGNY07D68C351V").matchLastName(""); //false

mismatchLastName

Validator.codiceFiscale("VRNGNY07D68C351V").mismatchLastName("Vareni"); //false
Validator.codiceFiscale("VRN").mismatchLastName("Vareni"); //false
Validator.codiceFiscale("").mismatchLastName("Vareni"); //false
Validator.codiceFiscale("VRNGNY07D68C351V").mismatchLastName("John"); //true
Validator.codiceFiscale("VRNGNY07D68C351V").mismatchLastName("V"); //true
Validator.codiceFiscale("VRNGNY07D68C351V").mismatchLastName(""); //false

matchFirstName

Validator.codiceFiscale("VRNGNY07D68C351V").matchFirstName("Genny"); //true
Validator.codiceFiscale("VRNGNY").matchFirstName("Genny"); //true
Validator.codiceFiscale("").matchFirstName("Genny"); //false
Validator.codiceFiscale("VRNGNY07D68C351V").matchFirstName("John"); //false
Validator.codiceFiscale("VRNGNY07D68C351V").matchFirstName("G"); //false
Validator.codiceFiscale("VRNGNY07D68C351V").matchFirstName(""); //false

mismatchFirstName

Validator.codiceFiscale("VRNGNY07D68C351V").mismatchFirstName("Genny"); //false
Validator.codiceFiscale("VRN").mismatchFirstName("Genny"); //false
Validator.codiceFiscale("").mismatchFirstName("Genny"); //false
Validator.codiceFiscale("VRNGNY07D68C351V").mismatchFirstName("John"); //true
Validator.codiceFiscale("VRNGNY07D68C351V").mismatchFirstName("G"); //true
Validator.codiceFiscale("VRNGNY07D68C351V").mismatchFirstName(""); //false

matchBirthDate

Validator.codiceFiscale("VRNGNY07D68C351V").matchBirthDate("2007-04-28"); //true
Validator.codiceFiscale("VRNGNY07D68").matchBirthDate("2007-04-28"); //true
Validator.codiceFiscale("").matchBirthDate("2007-04-28"); //false
Validator.codiceFiscale("VRNGNY07D68C351V").matchBirthDate("2008-02-16"); //false
Validator.codiceFiscale("VRNGNY07D68C351V").matchBirthDate(""); //false

mismatchBirthDate

Validator.codiceFiscale("VRNGNY07D68C351V").mismatchBirthDate("2007-04-28"); //false
Validator.codiceFiscale("VRNGNY07D68").mismatchBirthDate("2007-04-28"); //false
Validator.codiceFiscale("").mismatchBirthDate("2007-04-28"); //false
Validator.codiceFiscale("VRNGNY07D68C351V").mismatchBirthDate("2008-02-16"); //true
Validator.codiceFiscale("VRNGNY07D68C351V").mismatchBirthDate(""); //false

matchGender

Validator.codiceFiscale("VRNGNY07D68C351V").matchGender("F"); //true
Validator.codiceFiscale("VRNGNY07D68").matchGender("F"); //true
Validator.codiceFiscale("VRNGNY07D6").matchGender("F"); //true
Validator.codiceFiscale("").matchGender("F"); //false
Validator.codiceFiscale("VRNGNY07D68C351V").matchGender("M"); //false
Validator.codiceFiscale("VRNGNY07D68C351V").matchGender(""); //false

mismatchGender

Validator.codiceFiscale("VRNGNY07D68C351V").mismatchGender("F"); //false
Validator.codiceFiscale("VRNGNY07D68").mismatchGender("F"); //false
Validator.codiceFiscale("VRNGNY07D6").mismatchGender("F"); //false
Validator.codiceFiscale("").mismatchGender("F"); //false
Validator.codiceFiscale("VRNGNY07D68C351V").mismatchGender("M"); //true
Validator.codiceFiscale("VRNGNY07D68C351V").mismatchGender(""); //false

matchBirthPlace

Validator.codiceFiscale("VRNGNY07D68C351V").matchBirthPlace("CATANIA"); //true
Validator.codiceFiscale("VRNGNY07D68C351").matchBirthPlace("CATANIA"); //true
Validator.codiceFiscale("").matchBirthPlace("CATANIA"); //false
Validator.codiceFiscale("VRNGNY07D68C351V").matchBirthPlace("ROMA"); //false
Validator.codiceFiscale("VRNGNY07D68C351V").matchBirthPlace(""); //false

mismatchBirthPlace

Validator.codiceFiscale("VRNGNY07D68C351V").mismatchBirthPlace("CATANIA"); //false
Validator.codiceFiscale("VRNGNY07D68C351").mismatchBirthPlace("CATANIA"); //false
Validator.codiceFiscale("").mismatchBirthPlace("CATANIA"); //false
Validator.codiceFiscale("VRNGNY07D68C351V").mismatchBirthPlace("ROMA"); //true
Validator.codiceFiscale("VRNGNY07D68C351V").mismatchBirthPlace(""); //false

🔃 Compatibility

  • [X] NodeJs
  • [X] Chrome
  • [X] Firefox
  • [X] Edge

✋ DISCLAMER

All names, informations, and fiscal codes used in this README and all unit tests are fictitious. No identification with actual persons (living or deceased) is intended or should be inferred

📜 LICENSE

MIT License

FOSSA Status

📚 ASSETS LICENSES AND AUTHORS

  • Cities List of Values: CC BY 4.0 Ministero dell'interno
  • Cities List of Values: CC BY 4.0 Agenzia delle Entrate
  • Countries List of Values: CC BY 3.0 Istituto nazionale di statistica

📝 AUTHOR

Marco Ricupero

📬 CONTRIBUTORS