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

msk

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

msk

Small library to mask strings

  • 1.0.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5.7K
decreased by-0.9%
Maintainers
1
Weekly downloads
 
Created
Source

msk Build Status

Small library to mask strings

Install

$ npm install msk

Usage

const msk = require("msk");

msk("552122222222", "+99 (99) 9999-9999")
// "+55 (21) 2222-2222"

msk.fit("22231-0004131", "99999-999")
// "22231-000"

API

msk(str, mask)

Returns a formatted string based on the mask prodived

str

Type: string

A string to apply the mask.

mask

Type: string

A mask is formed based on the following symbols:

SymbolAccepts
9Numbers ([0-9])
ALetters ([A-ú])
SAlphanumeric chars ([A-ú0-9])
*Anything
other charSpecified char

msk.fit(str, mask)

Returns a formatted string removing the exceeding characters.

Examples

msk("552122222222", "+99 (99) 9999-9999")
// "+55 (21) 2222-2222"
msk("V6G1C9", "A9A 9A9")
// "V6G 1C9"
msk("I love msk", "*-****-***")
// "I-love-msk"
msk.fit("22231-0004131", "99999-999")
// "22231-000"

License

MIT © VTEX

Keywords

FAQs

Package last updated on 17 Mar 2020

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