New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

maskfy

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

maskfy

A Javascript library without a dependency of jQuery, Zepto, and etc ... Very simple to install and use. With only 1kb (gzip) code, it's also well accepted on mobile devices

2.0.1
latest
Source
npm
Version published
Maintainers
1
Created
Source

Maskfy (2.0.0) - Input Mask Simple

A Javascript library without a dependency of jQuery, Zepto, and etc ... Very simple to install and use. With only 1kb (gzip) code, IE Compatibility, it's also well accepted on mobile devices

Install / Usage

Add Maskfy file

<script src="https://cdn.rawgit.com/figuarnieri/maskfy/master/maskfy.js"></script>
or
<script src="path/js/maskfy.es5.js"></script>

HTML (by class or attribute)

Insert a selector in class tag

<input class="page--input" data-maskfy="999.999.999-99" type="text" placeholder="CPF (Ex.: 999.999.999-99)">
or
<input class="page--input mask-by-class" type="text" placeholder="CPF (Ex.: 999.999.999-99)">

Javascript Options

<script>
  new Maskfy({
    tag: '[data-maskfy]', //{String: undefined} (required) selector input
    mask: '999.999.999,99', //{String: undefined} (required) input mask pattern
    reverse: true, //{Boolean: false} reverse typing
    minSize: 3 //{Number: false} minimum digits
    defaultValue: '123' //{String: undefined} initial value
    letters: true //{Boolean: false} allowed letters
    after: (input) => console.log(input) //{Function: undefined} after input event
  });
</script>

HTML attributes [data-*]

If necessary, you could add attributes in the tag, to configure your mask options

data-maskfy

<input data-maskfy="999.999.999,99">

data-maskfy-reverse

<input data-maskfy="999.999.999,99" data-maskfy-reverse="true">

data-maskfy-minsize

<input data-maskfy="999.999.999,99" data-maskfy-reverse="true" data-maskfy-minsize="3">

data-letters

<input data-maskfy="999.999.999,99" data-maskfy-letters="true">

default value

<input data-maskfy="999.999.999,99" value="123.456.789,01">

Source

Github | npm | React | Example | @figuarnieri

License

The MIT License Copyright 2018 © Filipe Guarnieri

Keywords

1kb

FAQs

Package last updated on 10 Aug 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts