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

util-mask

v1.0.2

Published

A library with treatment for several masks.

Downloads

32

Readme

Use mask

A library with treatment for several masks.

Installation

npm install util-mask --save

Available functions

Use

Import the necessary functions from the package:

// Example
import { onlyNumber, onlyLetterMask } from 'util-mask';

Using the masks:

Only Number Mask

console.log(onlyNumberMask('abc12345abc678909abc'));  // Output: 123456789

Only Letter Mask

console.log(onlyLetterMask('abc123!@#'));  // Output: abc

Only Special Character Mask

console.log(onlySpecialCharacterMask('123!@#abc'));  // Output: !@#

Cpf Mask

console.log(cpfMask('12345678909'));  // Output: 123.456.789-09

Un Cpf Mask

console.log(unCpfMask('123.456.789-09'));  // Output: 12345678909

Is Valid CPF Mask

console.log(isValidCpfMask('123.456.789-09'));  // Output: true || false

Rg Mask

console.log(rgMask('112223334'));  // Output: 11.222.333-4

Un Rg Mask

console.log(unRgMask('11.222.333-4'));  // Output: 112223334

Cnpj Mask

console.log(cnpjMask('11222333444455'));  // Output: 11.222.333/4444-55

Un Cnpj Mask

console.log(unCnpjMask('11.222.333/4444-55'));  // Output: 11222333444455

Cpf Cnpj Mask

console.log(cpfCnpjMask('11122233344'));  // Output: 111.222.333-44

Cpf Cnpj Mask

console.log(cpfCnpjMask('11222333444455'));  // Output: 11.222.333/4444-55

Phone Mask

console.log(phoneMask('11222223333'));  // Output: (11) 22222-3333

Un Phone Mask

console.log(unPhoneMask('(11) 22222-3333'));  // Output: 11222223333

Cep Mask

console.log(cepMask('11111222'));  // Output: 11111-222

Un Cep Mask

console.log(unCepMask('11111-222'));  // Output: 11111222

Date Us Br Mask

console.log(dateUsBrMask('1111-11-11'));  // Output: 11/11/2020

Date Br Us Mask

console.log(dateBrUsMask('11/11/2020'));  // Output: 2020-11-11

Decimal Number Mask

console.log(decimalNumberMask('1,1,1,1,1,1,1,'));  // Output: 1.1111.11

Capitalize First Letter Mask

console.log(capitalizeFirstLetterMask('test test test'));  // Output: Test Test Test

Currency BRL Mask

console.log(currencyBrlMask('111222'));  // Output: R$ 111.222,00

Credit Card Date Mask

console.log(creditCardDateMask('1120'));  // Output: 11/20