Skip to content

Commit e62e179

Browse files
authored
Merge pull request #17 from egermano/feature/refactoring-cnpj
New major version
2 parents 005e57a + dee7980 commit e62e179

File tree

10 files changed

+8591
-3638
lines changed

10 files changed

+8591
-3638
lines changed

.eslintrc.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
module.exports = {
2+
"env": {
3+
"browser": true,
4+
"es2021": true,
5+
"node": true
6+
},
7+
"extends": [
8+
"eslint:recommended",
9+
"plugin:@typescript-eslint/recommended"
10+
],
11+
"overrides": [
12+
],
13+
"parser": "@typescript-eslint/parser",
14+
"parserOptions": {
15+
"ecmaVersion": "latest",
16+
"sourceType": "module"
17+
},
18+
"plugins": [
19+
"@typescript-eslint"
20+
],
21+
"rules": {
22+
}
23+
}

.github/workflows/nodejs.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Node.js
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
8+
runs-on: ubuntu-latest
9+
10+
strategy:
11+
matrix:
12+
node-version: [14.x, 16.x, 18.x]
13+
14+
steps:
15+
- uses: actions/checkout@v1
16+
- name: Use Node.js ${{ matrix.node-version }}
17+
uses: actions/setup-node@v1
18+
with:
19+
node-version: ${{ matrix.node-version }}
20+
- name: install, build, and test
21+
run: |
22+
npm ci
23+
npm run lint
24+
npm run build
25+
npm run test
26+
env:
27+
CI: true

README.md

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,30 @@
11
# Brazilian Document Validator
22
A Node.js module that validate brazilian documents as CPF and CPNJ.
33

4+
🇧🇷 Modulo em Node.js para validação de documento CPF e CNPJ.
5+
46
[![Build Status](https://travis-ci.org/egermano/brazilian-multidocument-validator.svg?branch=master)](https://travis-ci.org/egermano/brazilian-multidocument-validator)
7+
![Node.js](https://github.com/egermano/brazilian-multidocument-validator/workflows/Node.js/badge.svg)
58

69
## Installation
710
```sh
8-
npm install br-doc-validator --save
11+
npm add br-doc-validator
12+
# or
913
yarn add br-doc-validator
1014
```
1115

1216
## Usage
13-
### Javascript
17+
1418
```javascript
15-
var validator = require('br-doc-validator');
16-
let document = '00000000353';
17-
validator.documentValidatorProm(document).then((result) => {
18-
console.log('valid');
19-
}, (err) => {
20-
console.log('invalid');
21-
});
22-
```
23-
```sh
24-
Output should be 'valid'
25-
```
19+
const validator = require('br-doc-validator');
20+
const document = '00000000353';
21+
const result = validator.documentValidator(document);
2622

27-
### TypeScript
28-
```typescript
29-
import { documentValidatorProm as validator } from 'br-doc-validator';
30-
let document = '00000000000353';
31-
validator(document).then((result) => {
23+
if(result) {
3224
console.log('valid');
33-
}, (err) => {
25+
} else {
3426
console.log('invalid');
35-
});
27+
}
3628
```
3729
```sh
3830
Output should be 'valid'
@@ -41,5 +33,4 @@ Output should be 'valid'
4133
## Test
4234
```sh
4335
npm run test
44-
yarn test
4536
```

jest.config.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/** @type {import('ts-jest').JestConfigWithTsJest} */
2+
module.exports = {
3+
preset: "ts-jest",
4+
testEnvironment: "node",
5+
collectCoverage: true,
6+
};

0 commit comments

Comments
 (0)