Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/gabeidx/cnpj

🇧🇷 Format, validate and generate CNPJ numbers in Node & Deno
https://github.com/gabeidx/cnpj

brasil brazil cnpj cnpj-numbers cnpj-validator deno denoland generation node nodejs validation

Last synced: about 3 hours ago
JSON representation

🇧🇷 Format, validate and generate CNPJ numbers in Node & Deno

Awesome Lists containing this project

README

        

# CNPJ

Format, validate and generate CNPJ numbers.

## Installation

### Node

```bash
npm install cnpj
```

or, if you are using jsr

```bash
npx jsr add @brazil/cnpj
```

```ts
import { validate, format, generate } from 'cnpj';
```

### Deno

```bash
deno add @brazil/cnpj
```

```ts
import { validate, format, generate } from '@brazil/cnpj';
```

## Usage

```js
// Validation
const valid = validate('38.981.218/0001-47'); // true

// Format
const formatted = format(88415345000157) // 88.415.345/0001-57

// Generation
const generated = generate(); // randomly generated, valid CNPJ
```

### License

[MIT License](https://gabrielizaias.mit-license.org) © [Gabriel Silva](https://gabe.id)