1.5.1 • Published 10 months ago

@lacussoft/cpf-gen v1.5.1

Weekly downloads
16
License
MIT
Repository
github
Last release
10 months ago

LacusSoft :: cpf-gen

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

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

Browser Support

ChromeFirefoxSafariOperaEdgeIE
Latest ✔Latest ✔Latest ✔Latest ✔Latest ✔11 ✔

Installation

# using NPM
$ npm install --save @lacussoft/cpf-gen

# using Bun
$ bun add @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!
1.5.1

10 months ago

1.5.0

10 months ago

1.4.1

10 months ago

1.3.2

11 months ago

1.4.0

10 months ago

1.3.1

12 months ago

1.3.0

1 year ago

1.2.1

4 years ago

1.2.0

5 years ago

1.1.4

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.2

6 years ago

1.0.3

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago