Git Product home page Git Product logo

codicefiscalejs's Introduction

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)
  • 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",
    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.

codicefiscalejs's People

Contributors

bionicvapourboy avatar bwlt avatar lucabertolasi avatar lucavandro avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

carloscano93

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.