CodiceFiscaleJS/readme.md

106 lines
2.0 KiB
Markdown
Raw Normal View History

2016-03-22 20:23:28 +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)
2017-09-06 00:14:16 +02:00
```js
var cf = CodiceFiscale.compute({
name: "Enzo",
surname: "Righi",
gender: "M",
day: 24,
month: 7,
year: 1957,
birthplace: "Napoli",
2018-01-14 00:24:28 +01:00
birthplaceProvincia: "NA"});
2017-09-06 00:14:16 +02:00
```
**NEW** Added support for foreign countries
===
Use the italian name of the foreign country (e.g. Francia, for France) as birthplace
2017-09-06 00:17:34 +02:00
and "EE" as birthplace_provincia
2017-09-06 00:14:16 +02:00
```js
var cf = CodiceFiscale.compute({
2017-09-06 00:24:31 +02:00
name: "Enzo",
2017-09-06 00:14:16 +02:00
surname: "Righi",
gender: "M",
day: 24,
month: 7,
year: 1957,
birthplace: "Francia",
2018-01-14 00:24:28 +01:00
birthplaceProvincia: "EE"});
2017-09-06 00:14:16 +02:00
```
----------
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)
```js
var personData = CodiceFiscale.computeInverse("RGHNZE10L24F839E");
2017-09-06 00:14:16 +02:00
// personData
{
name: "NZE",
surname: "RGH",
gender: "M",
day: 24,
month: 7
year: [1910, 2010],
birthplace: "NAPOLI",
2018-01-14 00:24:28 +01:00
birthplaceProvincia: "NA"
}
```
2016-03-22 20:23:28 +01:00
----------
Check
-------
Check if a codice fiscale is valid. It returns a **boolean** value.
```js
var isValid = CodiceFiscale.check("VNDLDL10A01G410Z");
```
----------
Omocodie
-------
Get all the omocodie for a given Codice Fiscale. It returns an array of strings
```js
var omocodie = CodiceFiscale.getOmocodie("VNDLDL10A01G410Z");
```
2017-03-10 12:46:46 +01:00
-------
## Available npm scripts:
- `npm run build`: build the bundle into `dist` directory.
2018-01-14 00:24:28 +01:00
- `npm run test`: launch the jest tests.