Added type definitions for cnpj (#42101)

* Added type definitions for cnpj

* removendo patch versioN

* corrigindo github url
This commit is contained in:
Miguel 2020-02-05 14:53:07 -04:00 committed by GitHub
parent d05a9de5c6
commit d9a1b4bc72
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 53 additions and 0 deletions

5
types/cnpj/cnpj-tests.ts Normal file
View File

@ -0,0 +1,5 @@
import * as cnpj from 'cnpj';
const valid: boolean = cnpj.validate('38.981.218/0001-47');
const formatted: string = cnpj.format(88415345000157);
const generated: string = cnpj.generate();

24
types/cnpj/index.d.ts vendored Normal file
View File

@ -0,0 +1,24 @@
// Type definitions for cnpj 3.0
// Project: https://github.com/gabrielizaias/cnpj
// Definitions by: Miguel A. Almeida <https://github.com/migueldevmt>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/**
* Verifica validade do cnpj
* @param cnpj o CNPJ a ser validado.
* @returns Verdadeiro ou falso indicando a validade.
*/
export function validate(cnpj: string): boolean;
/**
* Formata o cnpj com pontos e barra
* @param cnpj o CNPJ a ser formatado.
* @returns A string formatado.
*/
export function format(cnpj: number): string;
/**
* Gera um cnpj aleatorio e valido
* @returns CNPJ gerado
*/
export function generate(): string;

23
types/cnpj/tsconfig.json Normal file
View File

@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"cnpj-tests.ts"
]
}

1
types/cnpj/tslint.json Normal file
View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }