🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

maskemail

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

maskemail

Converts example@test.com into e******@t***.com for secure display

1.0.0
latest
Source
npm
Version published
Weekly downloads
26
-13.33%
Maintainers
1
Weekly downloads
 
Created
Source

maskemail

A simple e-mail address masking utility for JavaScript. It replaces parts of e-mail addresses with a masking character, but keeping the overall format of the address recognisable. Useful for secure display, for situations when you want to tell users where you sent password reset instructions or some other sensitive information, without giving away too much data.

example@test.com => e******@t***.com

  • No dependencies
  • Compatible with Node and most browsers
  • Simple, unit-tested, production-ready

Install using NPM

npm install maskemail -S

Usage

Call with a single argument to get the default mask, using * for replacement:

const maskemail = require('maskemail')
console.log(maskemail('testme@some.domain.gov'))

=> t*****@s***.d*****.gov

Call with options in the second argument to customise the process. Available options are:

  • replacement: (string) the character to use for masking, the default value is *
  • allowed: (RegExp) matcher for characters delimit groups (the default value is /@\."+/)

const maskemail = require('maskemail')

console.log(maskemail('example@test.com', {replacement: '#'}))

=> 'e######@t###.com'

console.log(maskemail('firstname-lastname@domain-one.com', {allowed: /@\.-/}))

=> 'f********-l*******@d*****-o**.com'

FAQs

Package last updated on 07 Dec 2017

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