pt-id
    TypeScript icon, indicating that this package has built-in type declarations

    1.1.0 • Public • Published

    pt-id

    Build Status

    A library for validating and generating Portuguese identity numbers.

    The following identity numbers are supported:

    • Número de Identificação Civil / Bilhete de Identidade (BI) - Civil Identification Number
    • Número de Identificação Fiscal (NIF) - Fiscal Identification Number
    • Número de Documento do Cartão de Cidadão (CC) - Citizen's Card Document Number

    Installation

    npm install pt-id

    Usage

    var nif = require('pt-id').nif;
    var bi = require('pt-id').bi;
    var cc = require('pt-id').cc;
     
    console.log(nif.generate('company'));
    console.log(bi.generate());
    console.log(cc.generate());
     
    if (nif.validate('100000002', 'personal')) {
        console.log('is valid');
    }
     
    if (bi.validate('900000007')) {
        console.log('is valid');
    }
     
    if (cc.validate('000000000ZZ4')) {
        console.log('is valid');
    }

    License

    MIT

    Install

    npm i pt-id

    DownloadsWeekly Downloads

    110

    Version

    1.1.0

    License

    MIT

    Unpacked Size

    13.8 kB

    Total Files

    16

    Last publish

    Collaborators

    • asmarques