Go to file
2017-09-06 18:51:01 +02:00
dist added "Inverse Computation" to get a person data given for a given Codice Fiscale + updated README 2017-09-06 18:25:49 +02:00
src added "Inverse Computation" to get a person data given for a given Codice Fiscale + updated README 2017-09-06 18:25:49 +02:00
tests added tests for "Inverse Computation" (.computeInverse) method 2017-09-06 18:51:01 +02:00
.gitignore Add bundle 2017-03-10 12:40:40 +01:00
bower.json Some configuration fixes 2017-03-10 12:41:31 +01:00
codice.fiscale.min.js Init 2016-03-22 20:23:28 +01:00
karma.conf.js Exporting module 2017-03-10 12:20:20 +01:00
LICENSE Initial commit 2016-03-22 20:20:42 +01:00
package-lock.json added "Inverse Computation" to get a person data given for a given Codice Fiscale + updated README 2017-09-06 18:25:49 +02:00
package.json added "Inverse Computation" to get a person data given for a given Codice Fiscale + updated README 2017-09-06 18:25:49 +02:00
readme.md added "Inverse Computation" to get a person data given for a given Codice Fiscale + updated README 2017-09-06 18:25:49 +02:00
webpack.config.js Compute works with json object as param 2017-09-05 23:56:46 +02:00
yarn.lock Update yarn lock file 2017-03-10 12:41:22 +01:00

CodiceFiscale.js

CodiceFiscale.js is a utility library to compute and validate Italian Italian Tax code (codice fiscale).

Usage

Compute

Compute a codice fiscale given:

  • Name (String)
  • Surname (String)
  • Gender (String) ["M","F"]
  • Birthday day (Number)
  • Birthday month (Number)
  • Birthday year (Number)
  • Place of birth (String)
  • Province of birth (String)
var cf = CodiceFiscale.compute("Enzo","Righi","M",24,7,1957,"Napoli", "NA");

or

var cf = CodiceFiscale.compute({
    name: "Enzo",
    surname: "Righi",
    gender: "M",
    day: 24,
    month: 7,
    year: 1957,
    birthplace: "Napoli", 
    birthplace_provincia: "NA"});

NEW Added support for foreign countries

Use the italian name of the foreign country (e.g. Francia, for France) as birthplace and "EE" as birthplace_provincia

var cf = CodiceFiscale.compute("Enzo","Righi","M",24,7,1957,"Francia", "EE");

or

var cf = CodiceFiscale.compute({
    name: "Enzo",
    surname: "Righi",
    gender: "M",
    day: 24,
    month: 7,
    year: 1957,
    birthplace: "Francia", 
    birthplace_provincia: "EE"});

Inverse Computation

Get a person data for a given Codice Fiscale. It returns an object:

  • Name (String)
  • Surname (String)
  • Gender [String, String]
  • Birthday day (Number)
  • Birthday month [Number, String]
  • Birthday year [Number]
  • Place of birth (String)
  • Province of birth (String)
var personData = CodiceFiscale.computeInverse("RGHNZE10L24F839E");

// personData
{
    name: "NZE",
    surname: "RGH",
    gender: ["M", "MASCHIO"],
    day: 24,
    month: [7, "LUGLIO"],
    year: [1910, 2010],
    birthplace: "NAPOLI",
    birthplace_provincia: "NA"
}

Check

Check if a codice fiscale is valid. It returns a boolean value.

var isValid = CodiceFiscale.check("VNDLDL10A01G410Z");

Omocodie

Get all the omocodie for a given Codice Fiscale. It returns an array of strings

var omocodie = CodiceFiscale.getOmocodie("VNDLDL10A01G410Z");

Available npm scripts:

  • npm run build: build the bundle into dist directory.
  • npm run test: launch the karma tests.