diff --git a/package.json b/package.json index 228364c..51372a0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@platformbuilders/validations", - "version": "0.0.2", + "version": "0.0.3", "description": "", "author": "Platform Builders ", "repository": { diff --git a/src/isValidCnpj.ts b/src/isValidCnpj.ts index e15c6d5..17c548b 100644 --- a/src/isValidCnpj.ts +++ b/src/isValidCnpj.ts @@ -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; diff --git a/src/isValidCpf.ts b/src/isValidCpf.ts index f5e3c4b..755daae 100644 --- a/src/isValidCpf.ts +++ b/src/isValidCpf.ts @@ -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;