From 37c00ef0f8dd7d00872f36af0c4217de87a38ec0 Mon Sep 17 00:00:00 2001 From: Flaviano Rodrigues Date: Thu, 12 Jan 2023 01:00:52 -0300 Subject: [PATCH] bugs fixeds --- .npmignore | 4 +++- package.json | 4 ++-- src/index.ts | 7 ++++++- tsconfig.json | 2 +- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/.npmignore b/.npmignore index 99c2a59..0ace482 100644 --- a/.npmignore +++ b/.npmignore @@ -1,4 +1,6 @@ node_modules src package-lock.json -tsconfig.json \ No newline at end of file +tsconfig.json +.github +.eslintrc.json \ No newline at end of file diff --git a/package.json b/package.json index 636217f..e56eb29 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "flaformatter", - "version": "2.0.2", + "version": "2.0.3", "description": "A formatter to easily your code", "homepage": "https://github.com/Flaviano-Rodrigues/flaformatter", "repository": { @@ -13,7 +13,7 @@ "scripts": { "test": "node test.js", "build": "tsc --build && npm run minify", - "minify": "esbuild dist/index.js --minify --outfile=dist/index.js --bundle --target=es2016 --allow-overwrite", + "minify": "esbuild dist/index.js --minify --outfile=dist/index.js --allow-overwrite", "lint": "eslint ." }, "prepublish": "npm run build", diff --git a/src/index.ts b/src/index.ts index 3e8ce5c..5aa6676 100644 --- a/src/index.ts +++ b/src/index.ts @@ -6,7 +6,12 @@ interface e { } } -const flaformatter = (e: e, type: string, setMax = false, callback = null): void => { +const flaformatter = ( + e: e, + type: 'letters' | 'rg' | 'cpf' | 'cnpj' | 'cpf/cnpj' | 'telefone' | 'int' | 'celular' | 'data' | 'cep' | 'money' | 'card', + setMax = false, + callback = null +): void => { // retira os caracteres indesejados... let val = type === 'letters' ? e.target.value.replace(/[^a-zA-Z]/g, '') : e.target.value.replace(/[^\d]/g, '') diff --git a/tsconfig.json b/tsconfig.json index 88ec355..a991353 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "target": "es2016", - "module": "commonjs", + "module": "ESNext", "rootDir": "./src", "declaration": true, "outDir": "./dist",