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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@yagolopes/masks

v1.0.4

Published

Máscaras para Javascript

Downloads

9

Readme

@yagolopes/masks/lib/br

Biblioteca de máscaras do Brasil

Instalação

npm install @yagolopes/masks

ou

yarn add @yagolopes/masks

Utilização

CPF

import { CPF } from '@yagolopes/masks/lib/br';
// ou const { CPF } = require('@yagolopes/masks/lib/br');

// Add mask
const cpf = CPF.mask('59636985148');
console.log(cpf); // '596.369.851-48'

// Clean mask
const cpf = CPF.clean('596.369.851-48');
console.log(cpf); // '59636985148'

RG

import { RG } from '@yagolopes/masks/lib/br';
// ou const { RG } = require('@yagolopes/masks/lib/br');

// Add mask
const rg = RG.mask('698554859');
console.log(rg); // '69.855.485-9'

// Clean mask
const rg = RG.clean('69.855.485-9');
console.log(rg); // '698554859'

CNPJ

import { CNPJ } from '@yagolopes/masks/lib/br';
// ou const { CNPJ } = require('@yagolopes/masks/lib/br');

// Add mask
const cnpj = CNPJ.mask('34234234234234');
console.log(cnpj); // '34.234.234/2342-34'

// Clean mask
const cnpj = CNPJ.clean('34.234.234/2342-34');
console.log(cnpj); // '34234234234234'

Celular

import { CELULAR } from '@yagolopes/masks/lib/br';
// ou const { CELULAR } = require('@yagolopes/masks/lib/br');

// Add mask
const celular = CELULAR.mask('11958625974');
console.log(celular); // '(11) 95862-5974'

// Clean mask
const celular = CELULAR.clean('(11) 95862-5974');
console.log(celular); // '11958625974'

Telefone

import { TELEFONE } from '@yagolopes/masks/lib/br';
// ou const { TELEFONE } = require('@yagolopes/masks/lib/br');

// Add mask
const telefone = TELEFONE.mask('1195862597');
console.log(telefone); // '(11) 9586-2597'

// Clean mask
const telefone = TELEFONE.clean('(11) 9586-2597');
console.log(telefone); // '1195862597'

CEP

import { CEP } from '@yagolopes/masks/lib/br';
// ou const { CEP } = require('@yagolopes/masks/lib/br');

// Add mask
const cep = CEP.mask('06985596');
console.log(cep); // '06985-596'

// Clean mask
const cep = CEP.clean('06985-596');
console.log(cep); // '06985596'

Número

import { NUMERO } from '@yagolopes/masks/lib/br';
// ou const { NUMERO } = require('@yagolopes/masks/lib/br');

// Add mask
const numero = NUMERO.mask(123456.789);
console.log(numero); // '123.456,789'

// Clean mask
const numero = NUMERO.clean('123.456,789');
console.log(numero); // 123456.789

Porcentagem

import { PORCENTAGEM } from '@yagolopes/masks/lib/br';
// ou const { PORCENTAGEM } = require('@yagolopes/masks/lib/br');

// Add mask
const porcentagem = PORCENTAGEM.mask(26.95);
console.log(porcentagem); // '26,95%'

// Clean mask
const porcentagem = PORCENTAGEM.clean('26,95%');
console.log(porcentagem); // 26.95

Dinheiro

import { DINHEIRO } from '@yagolopes/masks/lib/br';
// ou const { DINHEIRO } = require('@yagolopes/masks/lib/br');

// Add mask
const dinheiro = DINHEIRO.mask(123456.78);
console.log(dinheiro); // 'R$ 123.456,78'

// Clean mask
const dinheiro = DINHEIRO.clean('R$ 123.456,78');
console.log(dinheiro); // '123456.78'

Cartão

import { CARTAO } from '@yagolopes/masks/lib/br';
// ou const { CARTAO } = require('@yagolopes/masks/lib/br');

// Add mask
const cartao = CARTAO.mask(1234567891234567);
console.log(cartao); // '1234 5678 9123 4567'

// Clean mask
const cartao = CARTAO.clean('1234 5678 9123 4567');
console.log(cartao); // 1234567891234567