npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

mask-utils-ccg

v4.2.0

Published

Biblioteca de máscaras para CPF, CNPJ, Telefone e CEP

Readme

mask-utils-ccg

🚀 Biblioteca de máscaras para JavaScript e TypeScript, ideal para formatação de números, datas, CPF, CNPJ, telefones e muito mais.

🔗 NPM: mask-utils-ccg

📦 Instalação

Você pode instalar o pacote via npm ou yarn:

Usando npm:

npm install mask-utils-ccg

Usando yarn:

yarn add mask-utils-ccg

🚀 Uso

Importação

JavaScript (CommonJS)

const { maskCPF, maskCNPJ, maskPhone, maskDate, maskCEP, maskRG, maskCreditCard, maskTime, validateCPF } = require('mask-utils-ccg');

TypeScript (ES Modules)

import { maskCPF, maskCNPJ, maskPhone, maskDate, maskCEP, maskRG, maskCreditCard, maskTime, validateCPF } from 'mask-utils-ccg';

Exemplos de Uso

📌 Máscara para CPF

maskCPF("12345678900"); // Saída: "123.456.789-00"

📌 Máscara para CNPJ

maskCNPJ("12345678000195"); // Saída: "12.345.678/0001-95"

📌 Máscara para Telefone

maskPhone("62987654321"); // Saída: "(62) 98765-4321"

📌 Máscara para CEP

maskCEP("72840000"); // Saída: "72.840-000"

📌 Máscara para RG

maskRG("123456789"); // Saída: "12.345.678-9"

📌 Máscara para Cartão de Crédito

maskCreditCard("1234567812345678"); // Saída: "1234 5678 1234 5678"

📌 Máscara para Data (DD/MM/YYYY)

maskDate("20250201"); // Saída: "01/02/2025"

📌 Máscara para Hora (HH:MM)

maskTime("1530"); // Saída: "15:30"

📌 Validação de CPF

validateCPF("12345678900"); // Saída: false
validateCPF("123.456.789-09"); // Saída: true

📚 Lista de Máscaras e Funções Disponíveis

| Função | Descrição | Exemplo de Entrada | Exemplo de Saída | |-------------------|------------------------------------------|---------------------|-----------------------| | maskCPF | Aplica máscara de CPF | "12345678900" | "123.456.789-00" | | maskCNPJ | Aplica máscara de CNPJ | "12345678000195" | "12.345.678/0001-95"| | maskPhone | Aplica máscara de telefone | "62987654321" | "(62) 98765-4321" | | maskCEP | Aplica máscara de CEP | "72840000" | "72.840-000" | | maskRG | Aplica máscara de RG | "123456789" | "12.345.678-9" | | maskCreditCard | Aplica máscara de cartão de crédito | "1234567812345678"| "1234 5678 1234 5678"| | maskDate | Aplica máscara de data (DD/MM/YYYY) | "20250201" | "01/02/2025" | | maskTime | Aplica máscara de hora (HH:MM) | "1530" | "15:30" | | validateCPF | Valida um CPF (verifica se é válido) | "12345678900" | false |

💻 Desenvolvimento

Se quiser contribuir com melhorias ou adicionar novas máscaras, siga os passos abaixo:

  1. Clone o repositório:

    git clone https://github.com/MichaelDouglasCA/mask-utils-ccg.git
  2. Instale as dependências:

    npm install
  3. Faça as alterações e rode os testes:

    npm test
  4. Crie um Pull Request.

📜 Licença

Este projeto está sob a licença MIT. Sinta-se livre para usá-lo e contribuir! 😃


Desenvolvido por Michael Douglas 🚀