Neverending Package Mountain
    Have ideas to improve npm?Join in the discussion! »

    @lacussoft/cpf-gen
    TypeScript icon, indicating that this package has built-in type declarations

    1.1.2 • Public • Published

    LacusSoft :: cpf-gen

    NPM Latest Version Downloads Count Bundle Size Test Status Last Update Date Project License

    Basic function to generate valid CPF (Brazilian ID document).

    Browser Support

    Chrome Firefox Safari Opera Edge IE
    Latest Latest Latest Latest Latest 11

    Installation

    $ npm install @lacussoft/cpf-gen

    Import

    // ES Modules
    import cpfGen from '@lacussoft/cpf-gen'
    
    // Common JS
    const cpfGen = require('@lacussoft/cpf-gen')

    or import it through your HTML file, using CDN:

    <script src="https://cdn.jsdelivr.net/npm/@lacussoft/cpf-gen@latest/dist/cpf-gen.min.js"></script>

    Usage

    let cpf = cpfGen()      // returns '47844241055'
    
    cpf = cpfGen({          // returns '005.265.352-88'
      format: true
    })
    
    cpf = cpfGen({          // returns '52825091138'
      prefix: '528250911'
    })
    
    cpf = cpfGen({          // returns '528.250.911-38'
      prefix: '528250911'
      format: true
    })

    Generator options

    cpfGen({
      format: false, // indicates if output should be formatted
      prefix: '',    // if you have a CPF initials and want to complete it with valid digits.
    })               //     The string provided must contain between 0 and 9 digits!

    Install

    npm i @lacussoft/cpf-gen

    DownloadsWeekly Downloads

    10

    Version

    1.1.2

    License

    MIT

    Unpacked Size

    28.8 kB

    Total Files

    11

    Last publish

    Collaborators

    • avatar