Skip to content

Commit

Permalink
fixing cpf and cnpj validations
Browse files Browse the repository at this point in the history
  • Loading branch information
ammichael committed Nov 19, 2020
1 parent 970215a commit 05a6ca9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@platformbuilders/validations",
"version": "0.0.2",
"version": "0.0.3",
"description": "",
"author": "Platform Builders <[email protected]>",
"repository": {
Expand Down
4 changes: 2 additions & 2 deletions src/isValidCnpj.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as CNPJ from '@fnando/cnpj';
import { toOnlyNumbers } from '@platformbuilders/helpers';

export const isValidCnpj = (value: string): boolean =>
CNPJ.isValid(toOnlyNumbers(value));
export const isValidCnpj = (value?: string): boolean =>
value ? CNPJ.isValid(toOnlyNumbers(value)) : false;
4 changes: 2 additions & 2 deletions src/isValidCpf.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as CPF from '@fnando/cpf';
import { toOnlyNumbers } from '@platformbuilders/helpers';

export const isValidCpf = (value: string): boolean =>
CPF.isValid(toOnlyNumbers(value));
export const isValidCpf = (value?: string): boolean =>
value ? CPF.isValid(toOnlyNumbers(value)) : false;

0 comments on commit 05a6ca9

Please sign in to comment.