Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
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
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-85.71%
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

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

  • 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