Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

maska

Package Overview
Dependencies
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

maska

Simple zero-dependency input mask for Vanilla JS, Vue, Alpine.js and Svelte

  • 3.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
156K
increased by3.3%
Maintainers
1
Weekly downloads
 
Created

What is maska?

Maska is a lightweight JavaScript library for input masking. It allows you to format user input in real-time, ensuring that the data entered matches a specified pattern. This is particularly useful for forms that require specific formats, such as phone numbers, dates, and credit card numbers.

What are maska's main functionalities?

Basic Masking

This feature allows you to apply a basic mask to an input field. In this example, the input field with the id 'phone' will be formatted as a US phone number.

const input = document.querySelector('#phone');
Maska.create(input, { mask: '(###) ###-####' });

Dynamic Masking

This feature allows you to apply a dynamic mask to an input field. In this example, the input field with the id 'date' will be formatted as a date in the format MM/DD/YYYY.

const input = document.querySelector('#date');
Maska.create(input, { mask: '##/##/####' });

Custom Placeholders

This feature allows you to use custom placeholders in your masks. In this example, the input field with the id 'custom' will be formatted as a credit card number with 'X' as the placeholder.

const input = document.querySelector('#custom');
Maska.create(input, { mask: '####-####-####-####', placeholder: 'X' });

Other packages similar to maska

Keywords

FAQs

Package last updated on 26 Aug 2024

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc