Go to file
Luca Adalberto Vandro 49724b60a1
Merge pull request #10 from Caine85/patch-1
Update readme.md
2018-01-16 22:58:36 +01:00
dist Fix Bug #7: setMonth(mm-1) quando selezionato Febbraio ritorna Marzo 2017-12-30 23:34:50 +01:00
src Fix Bug #7: setMonth(mm-1) quando selezionato Febbraio ritorna Marzo 2017-12-30 23:34:50 +01:00
tests improved location validation 2017-12-19 13:48:26 +01:00
.babelrc support for building es6 2017-12-18 21:53:20 +01: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
LICENSE Initial commit 2016-03-22 20:20:42 +01:00
package-lock.json added constants to CodiceFiscale as static consts 2017-12-19 13:26:02 +01:00
package.json Blue 2017-12-30 23:11:09 +01:00
readme.md Update readme.md 2018-01-14 00:24:28 +01:00
webpack.config.js improved modules creation for wider compatibility 2017-12-19 13:03:26 +01: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({
    name: "Enzo",
    surname: "Righi",
    gender: "M",
    day: 24,
    month: 7,
    year: 1957,
    birthplace: "Napoli", 
    birthplaceProvincia: "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({
    name: "Enzo",
    surname: "Righi",
    gender: "M",
    day: 24,
    month: 7,
    year: 1957,
    birthplace: "Francia", 
    birthplaceProvincia: "EE"});

Inverse Computation

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

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

// personData
{
    name: "NZE",
    surname: "RGH",
    gender: "M",
    day: 24,
    month: 7
    year: [1910, 2010],
    birthplace: "NAPOLI",
    birthplaceProvincia: "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 jest tests.