Socket
Socket
Sign inDemoInstall

slim-mask-js

Package Overview
Dependencies
0
Maintainers
3
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    slim-mask-js

A lightweight mask for JavaScript


Version published
Maintainers
3
Install size
14.6 kB
Created

Readme

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

FAQs

Last updated on 05 Dec 2018

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