Socket
Socket
Sign inDemoInstall

max-mask

Package Overview
Dependencies
0
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    max-mask

Simple masking solution for any frontend as well as nodejs. Provides composable for Vue3


Version published
Weekly downloads
69
decreased by-22.47%
Maintainers
1
Install size
17.7 kB
Created
Weekly downloads
 

Readme

Source

Max Mask

A simple masking solution for frontend applications as well as NodeJS. This package also provides a Vue3 composable for easier integration into Vue projects.

Installation

You can install this package via npm or yarn.

npm install max-mask
yarn add max-mask

Usage

As a Function

You can use the maskInput function to format strings according to a specified mask.

import { maskInput } from "max-mask";

const formattedPhone = maskInput("1234567890", "(###) ###-####");
console.log(formattedPhone); // Output: (123) 456-7890

As a Vue3 Composable

If you are working in a Vue3 environment, you can use the useMasking composable.

import { useMasking } from "max-mask";

const { mask } = useMasking();

//example 1
const formattedPhone = mask("1234567890", "(###) ###-####");

//example 2
const input = ref("");
const formatted = computed(() => mask(input.value, "(###) ###-####"));

Supported Masking Characters

  • #: Accepts a number
  • U: Alphanumeric, converts to uppercase
  • a: Letters, converts to lowercase
  • A: Letters, converts to uppercase
  • S: Alphanumeric, keeps the original case
  • X: Alphanumeric, keeps the original case
  • *: Makes the previous pattern repeatable forever

Contributing

Feel free to open issues and pull requests!

License

This project is licensed under the MIT License.

Author

Created by Maksym max@kozachenko.io.

Keywords

FAQs

Last updated on 30 Aug 2023

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc