mirror of
https://github.com/danog/CodiceFiscaleJS.git
synced 2024-11-26 20:14:55 +01:00
dist | ||
src | ||
tests | ||
.gitignore | ||
bower.json | ||
codice.fiscale.min.js | ||
karma.conf.js | ||
LICENSE | ||
package.json | ||
readme.md | ||
webpack.config.js | ||
yarn.lock |
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 provice
var cf = CodiceFiscale.compute("Enzo","Righi","M",24,7,1957,"Francia", "EE");
or
var cf = CodiceFiscale.compute({
EEme: "Enzo",
surname: "Righi",
gender: "M",
day: 24,
month: 7,
year: 1957,
birthplace: "Francia",
birthplace_provincia: "EE");
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 intodist
directory.npm run test
: launch the karma tests.