{"_id":"@agenus/mask","name":"@agenus/mask","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@agenus/mask","version":"1.0.0","description":"Pacote de máscaras para formatação","main":"./dist/index.js","types":"./dist/index.d.ts","author":{"name":"Tadeu Matos"},"license":"MIT","scripts":{"build":"tsc --declaration","start":"node ./dist/index.js","dev":"tsnd --transpile-only --respawn --ignore-watch node_modules exemple/javascript/exemple-simple.ts","test":"vitest"},"devDependencies":{"@types/jest":"^29.5.12","@typescript-eslint/eslint-plugin":"^5.43.0","eslint":"^8.0.1","eslint-config-standard-with-typescript":"^34.0.1","eslint-plugin-import":"^2.25.2","eslint-plugin-n":"^15.0.0","eslint-plugin-promise":"^6.0.0","jest":"^29.7.0","prettier":"^2.8.4","ts-jest":"^29.2.2","ts-node-dev":"^2.0.0","typescript":"*","vitest":"^2.0.3"},"repository":{"type":"git","url":"git+https://github.com/ReisSouza/formatString.git"},"keywords":[],"bugs":{"url":"https://github.com/ReisSouza/formatString.git/issues"},"homepage":"https://github.com/ReisSouza/formatString.git#readme","dependencies":{"build":"^0.1.4"},"_id":"@agenus/mask@1.0.0","gitHead":"ad50acd442bbd20254911aaf16f963352989ca9c","_nodeVersion":"20.12.1","_npmVersion":"10.8.1","dist":{"integrity":"sha512-y1MSOpA9kxpx1k1RwgMDjtZ+yjPP4k0/IrFWMJPaC5dIQTfRlPHLDpPC2GNTqgUrVwhoqxgSiQP0hpD6DOu5NA==","shasum":"f1c9aa0089abd40e8112ae00e6c9c79ea313de56","tarball":"https://registry.npmjs.org/@agenus/mask/-/mask-1.0.0.tgz","fileCount":161,"unpackedSize":219971,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCt7DaNZ1pLyftP1iWcffg5yj+yNz0Kkoy3Vp8lmcLVawIgZAFij4lGe8h/OG3xmVilunli7GpXJDMNDH6+7hWydRo="}]},"_npmUser":{"name":"reissouza","email":"reis.souza@outlook.com.br"},"directories":{},"maintainers":[{"name":"reissouza","email":"reis.souza@outlook.com.br"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mask_1.0.0_1721267446215_0.21633394809916573"},"_hasShrinkwrap":false}},"time":{"created":"2024-07-18T01:50:46.092Z","1.0.0":"2024-07-18T01:50:46.415Z","modified":"2024-07-18T01:50:46.716Z"},"maintainers":[{"name":"reissouza","email":"reis.souza@outlook.com.br"}],"description":"Pacote de máscaras para formatação","homepage":"https://github.com/ReisSouza/formatString.git#readme","keywords":[],"repository":{"type":"git","url":"git+https://github.com/ReisSouza/formatString.git"},"author":{"name":"Tadeu Matos"},"bugs":{"url":"https://github.com/ReisSouza/formatString.git/issues"},"license":"MIT","readme":"<p align=\\\"center\\\">\r\n  <a href=\\\"\\\" rel=\\\"noopener\\\">\r\n    <img width=200px height=200px src=\\\"https://i.imgur.com/6wj0hh6.jpg\\\" alt=\\\"Project logo\\\">\r\n  </a>\r\n</p>\r\n\r\n<h3 align=\\\"center\\\">@agenus/mask</h3>\r\n\r\n<div align=\\\"center\\\">\r\n\r\n[![Status](https://img.shields.io/badge/status-active-success.svg)]()\r\n[![GitHub Issues](https://img.shields.io/github/issues/agenus/mask.svg)](https://github.com/agenus/mask/issues)\r\n[![GitHub Pull Requests](https://img.shields.io/github/issues-pr/agenus/mask.svg)](https://github.com/agenus/mask/pulls)\r\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](/LICENSE)\r\n\r\n</div>\r\n\r\n---\r\n\r\n<p align=\\\"center\\\"> \r\nFunctionality that allows adding or removing masks from strings, working with any React library, or HTML, React, and JavaScript.\r\n</p>\r\n\r\n<p align=\\\"center\\\"> Available masks:</p>\r\n<p align=\\\"center\\\">\r\n  CPF | CNPJ | Phone | Postal Code | CPF or CNPJ | Currency | RG | Credit Card | Obscure Email | Number | Card Expiration Date | Date | Time | International Phone\r\n</p>\r\n\r\n# Table of Contents\r\n\r\n- [Table of Contents](#table-of-contents)\r\n- [Installation](#installation)\r\n- [Usage](#usage)\r\n- [Properties setMask](#properties-setmask)\r\n- [Type](#type)\r\n- [Usage single](#usage-single)\r\n- [Authors](#️-authors)\r\n- [Thanks](#thanks)\r\n\r\n# Installation\r\n\r\n\\`\\`\\`sh\r\nnpm i @agenus/mask\r\n\r\n# or\r\n\r\nyarn add @agenus/mask\r\n\\`\\`\\`\r\n\r\n# Usage\r\n\r\n\\`\\`\\`js\r\nimport { setMask, removeMask } from \\\"@agenus/mask\\\";\r\n\r\nconst cpf = setMask({ value: '00000000000', type: 'cpf' });\r\nconst cnpj = setMask({ value: '00000000000000', type: 'cnpj' });\r\nconst cpfOurCnpj1 = setMask({ value: '00000000000', type: 'cpfOurCnpj' });\r\nconst cpfOurCnpj2 = setMask({ value: '00000000000000', type: 'cpfOurCnpj' });\r\nconst currency = setMask({ value: '00000000000', type: 'currency' });\r\nconst phone = setMask({ value: '00000000000', type: 'phone' });\r\nconst postalCode = setMask({ value: '00000000000', type: 'postalCode' });\r\nconst rg = setMask({ value: '000000000', type: 'rg' });\r\nconst credCard = setMask({ value: '0000000000000000', type: 'credCard' });\r\nconst number = setMask({ value: '0dasdas0000dasdasd0dasdasd0000dasdas0dasd0', type: 'number' });\r\nconst obscureEmail = setMask({ value: 'user123@gmail.com', type: 'obscureEmail' });\r\nconst date = setMask({ value: '01012020', type: 'date' });\r\nconst time = setMask({ value: '123456', type: 'time' });\r\nconst internationalPhone = setMask({ value: '12345678901', type: 'internationalPhone' });\r\n\r\nconsole.log({\r\ncpf,\r\ncnpj,\r\ncpfOurCnpj1,\r\ncpfOurCnpj2,\r\ncurrency,\r\nphone,\r\npostalCode,\r\nrg,\r\ncredCard,\r\nnumber,\r\nobscureEmail,\r\ndate,\r\ntime,\r\ninternationalPhone\r\n});\r\n\r\n// Output\r\n{\r\ncpf: '000.000.000-00',\r\ncnpj: '00.000.000/0000-00',\r\ncpfOurCnpj1: '000.000.000-00',\r\ncpfOurCnpj2: '00.000.000/0000-00',\r\ncurrency: '0,00',\r\nphone: '(00) 00000-0000',\r\npostalCode: '00000-000',\r\nrg: '00.000.000-0',\r\ncredCard: '0000-0000-0000-0000',\r\nnumber: '000000000000',\r\nobscureEmail: 'u**\\*\\***@gmail.com',\r\ndate: '01/01/2020',\r\ntime: '12:34:56',\r\ninternationalPhone: '+12 (34) 5678-901'\r\n}\r\n\r\nconst removeCPF = removeMask(cpf);\r\nconst removeCNPJ = removeMask(cnpj);\r\nconst removeRG = removeMask(rg);\r\nconst removePostalCode = removeMask(postalCode);\r\nconst removePhone = removeMask(phone);\r\nconst removeCurrency = removeMask(currency);\r\nconst removeCred = removeMask(credCard);\r\nconst removeCPFORCNPJ1 = removeMask(cpfOurCnpj1);\r\nconst removeCPFORCNPJ2 = removeMask(cpfOurCnpj2);\r\n\r\nconsole.log({\r\nremoveCPF,\r\nremoveCNPJ,\r\nremoveRG,\r\nremovePostalCode,\r\nremovePhone,\r\nremoveCurrency,\r\nremoveCred,\r\nremoveCPFORCNPJ1,\r\nremoveCPFORCNPJ2,\r\n});\r\n\r\n// Output\r\n{\r\nremoveCPF: '00000000000',\r\nremoveCNPJ: '00000000000000',\r\nremoveRG: '000000000',\r\nremovePostalCode: '00000000',\r\nremovePhone: '00000000000',\r\nremoveCurrency: '00000000000',\r\nremoveCred: '0000000000000000',\r\nremoveCPFORCNPJ1: '00000000000',\r\nremoveCPFORCNPJ2: '00000000000000'\r\n}\r\n\\`\\`\\`\r\n\r\n# Properties setMask\r\n\r\n|     Name     |     Type     | Default | Description                          |\r\n| :----------: | :----------: | :-----: | :----------------------------------- |\r\n| **\\`type\\`** | \\`{String}\\` |         | Mask format                          |\r\n|  **value**   | \\`{String}\\` |         | String to be formatted               |\r\n|  **Prefix**  | \\`{String}\\` |         | Prefix added before formatted string |\r\n\r\n# Type\r\n\r\n\\`\\`\\`\r\n| CNPJ | CPFOURCNPJ | RG | PHONE | CURRENCY | POSTALCODE | CREDCARD | DATE | TIME | INTERNATIONALPHONE\r\n\\`\\`\\`\r\n\r\n# Usage single\r\n\r\n\\`\\`\\`js\r\nimport {\r\ncpfMask, cnpjMask, cpfOurCnpjMask, credCardMask, currencyMask, phoneMask, postalCodeMask, rgMask,\r\n} from \\\"@agenus/mask\\\";\r\n\r\nconst cpf = cpfMask('00000000000');\r\nconst cnpj = cnpjMask('00000000000000');\r\nconst cpfOurCnpj1 = cpfOurCnpjMask('00000000000');\r\nconst cpfOurCnpj2 = cpfOurCnpjMask('00000000000000');\r\nconst currency = currencyMask('00000000000');\r\nconst phone = phoneMask('00000000000');\r\nconst postalCode = postalCodeMask('00000000000');\r\nconst rg = rgMask('000000000');\r\nconst credCard = credCardMask('0000000000000000');\r\n\r\nconsole.log({\r\ncpf, cnpj, cpfOurCnpj1, cpfOurCnpj2, currency, phone, postalCode, rg, credCard,\r\n});\r\n\r\n// Output\r\n{\r\ncpf: '000.000.000-00',\r\ncnpj: '00.000.000/0000-00',\r\ncpfOurCnpj1: '000.000.000-00',\r\ncpfOurCnpj2: '00.000.000/0000-00',\r\ncurrency: 'R$ 000.000.000,00',\r\nphone: '(00) 00000-0000',\r\npostalCode: '00000-000',\r\nrg: '00.000.000-0',\r\ncredCard: '0000-0000-0000-0000'\r\n}\r\n\\`\\`\\`\r\n\r\n## ✍️ Authors <a name=\\\"authors\\\"></a>\r\n\r\n- [@ReisSouza](https://github.com/ReisSouza) - Idea & Initial work\r\n\r\nSee also the list of [contributors](https://github.com/agenus/mask/graphs/contributors) who participated in this project.\r\n\r\n# Thanks\r\n\r\nThanks to [BrowserStack](https://www.browserstack.com/) for the help with testing on real devices\r\n","readmeFilename":"README.md"}