DEV Community

mixbo
mixbo

Posted on • Updated on

You can hide sensitive data with '*'

Privacy Holder

Hide some sensitive data with character '*'

Features

  1. Support hide common user data like: email, phone number, id card etc.
  2. Support Custom rules (fragment method) to hide sensitive data.
  3. Test Coverage 100%

Install

yarn add privacy-holder
Enter fullscreen mode Exit fullscreen mode

or

npm install privacy-holder
Enter fullscreen mode Exit fullscreen mode

PS: Do not install version 0.0.4, 0.0.5 these versions are break

Usage

 const privacy = require('privacy-holder')
Enter fullscreen mode Exit fullscreen mode

Then

 privacy.email("ihavecoke@163.com") // ih*******@163.com
 privacy.name("ihavecoke") // *
 privacy.name("i havecoke") // *havecoke
 privacy.idCard("510122199102132018") // 510***19******2018
 privacy.phoneNumber("13800000000") // 138****0000
 privacy.all('all-will-be-*') // *************
Enter fullscreen mode Exit fullscreen mode

Also, you can custom rules like this

 privacy.fragment('abcdefgi','####',2,6) // ab####i
Enter fullscreen mode Exit fullscreen mode

more privacy-holder

Oldest comments (4)

Collapse
 
vga profile image
Victor Gallet

Is your github repo private? I have got a 404 not found error when I click on your link.

Collapse
 
hottabxp profile image
Sergey
Collapse
 
ihavecoke profile image
mixbo

Thks sergey

Collapse
 
ihavecoke profile image
mixbo

Sorry i post wrong url for post, now i have fixed it. :)