Socket
Book a DemoInstallSign in
Socket

slim-mask-js

Package Overview
Dependencies
Maintainers
3
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

slim-mask-js

A lightweight mask for JavaScript

0.0.7
latest
Source
npmnpm
Version published
Weekly downloads
7
Maintainers
3
Weekly downloads
 
Created
Source

A lightweight mask for JavaScript

Install

  • With npm

npm install slim-mask-js

  • With yarn (we <3 yarn)

yarn add slim-mask-js

Simple example using ES6

import mask from 'slim-mask-js'

mask('44999999999', '(##) # ####-####')
// (44) 9 9999-9999

Mask with custom tokens

import { maskit } from 'slim-mask-js'

const tokens = {
  '*': { pattern: /\d/ },
  X: { pattern: /[0-9a-zA-Z]/ },
  S: { pattern: /[a-zA-Z]/ },
  A: { pattern: /[a-zA-Z]/, transform: v => v.toLocaleUpperCase() },
  a: { pattern: /[a-zA-Z]/, transform: v => v.toLocaleLowerCase() },
  '!': { escape: true }
}

mask('44999999999', '(**) * ****-****')
// (44) 9 9999-9999

In browser

const mask = require('slim-mask-js').default
const maskit = require('slim-mask-js).maskit

Development

  • Install dependencies:

$yarn install or $npm install

  • Build

$yarn dist or $npm run dist

  • Test

$yarn test or $npm run test

Authors

  • Felipe Bohnert Paetzold felipe.paetzold@gmail.com

Keywords

mask

FAQs

Package last updated on 05 Dec 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

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.