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-form

v1.2.2

Published

A mask form

Readme

Mask Form

npm version Bower version

A mask to input[mask] fields;

Using Mask Form you can:

  • Using default mask rules;
  • Create your own masks;

Installation

Using like a library
$ git clone https://github.com/rlazarini/mask-form.git
<body>
...
...
<script src="path/to/mask-form/index.js"></script>
</body>
Using like a module
$ npm install mask-form --save

Usage

Using like a module
var maskForm = require('mask-form');
maskForm._maskForm(form);

Examples

Basic Usage
<body>
	<form action="" id="form" novalidate>
		<input type="text">
		<!-- Mask only fields with mask attribute -->
		<input type="text" mask="mask">
		<input type="cpf" mask>
		<input type="text" data-type="cpf" mask="mask">
		<input type="text" data-type="zipcode" mask="mask">
		<input type="text" data-type="date" data-format="00/00/0000" mask="mask">
		<input type="submit" value="send">
	</form>
	<script>
		var form = document.getElementById('form');
		maskForm._maskForm(form);
	</script>
</body>
Create your own mask, with type or data-type
<body>
	<form action="" id="form" novalidate>
		<input type="text" data-type="myownmask" mask="mask">
		<input type="myowntype" mask="mask">
		<input type="submit" value="send">
	</form>
	<script>
		var form = document.getElementById('form')
		,	obj  = {
			'myownmask': 'AAA/AA-000-0',
			'myowntype': '000.000-A-B-C'
		};
		
		maskForm._maskForm(form, obj);
	</script>
</body>
Mask a input using attribute data-type

In this method, the input don't lose your properties.

Default Options to data-type

cpf			## Mask like a Brazil document
cnpj		## Mask like a Brazil company document
cpfcnpj		## Mask like a Brazil document OR company document
phone		## Mask like a Brazilian phone number
zipcode		## Mask like a Brazilian zipcode address
currency	## Mask like a monetary value. By default, using R$ and currency format (R$ 1.000,00), but you can pass a monetary symbol with attribute data-monetary, and another options (see more above)
date		## Mask like a date. Default is 0000/00/00, but you can pass another model.

The data-type[currency], has 3 another attributes you can use:

data-monetary			## You can pass a monetary symbol to your mask, by default: R$
data-monetary-imperial	## You can tell whether the value will be written with imperial mode. Ex.: US$ 1,000,000.00
data-monetary-revert	## You can tell whether the value have the monetary symbol in the end. Ex.: 25 ¢

The input[date] (or data-type[date], if you wish), has 1 another attribute you can use:

data-format	## Pass the format of your date, by default use international date format (0000/00/00).