remove-sensitive-info
Version:
npm package to remove all sensitive info from data passed
74 lines (55 loc) • 2.02 kB
Markdown
//travis-ci.com/pdkpavankumar/remove-sensitive-info.svg?branch=master)](https://travis-ci.org/pdkpavankumar/remove-sensitive-info) [](https://david-dm.org/pdkpavankumar/remove-sensitive-info) [](https://david-dm.org/pdkpavankumar/remove-sensitive-info?type=dev) [](https://opensource.org/licenses/MIT)
Install `remove-sensitive-info` into to your project via `npm`:
```shell
$ npm install remove-sensitive-info --save-dev
```
new SensitiveInfo(config).parse(text) --- returns parsed text replacing all the sensitivie info (email, ssn, phone)
config:Object
```js
config = {
pattern: '####', // sensitive info will be replaced with this string
nodefaults: true // to remove default regex. by defaul this is false
regex: {
regexPattername1: regex1, // custom regex
regexPatternname2: [ regex21, regex22, regex33] // multiple custom regex
}
}
```
```js
import SensitiveInfo from 'remove-sensitive-info'
initialization(){
sensitiveinfo = new SensitiveInfo(config);
}
method(){
console.log(sensitiveinfo.parse('some awesome text with email pavankumar8545@gmail.com'));
}
```
output:
```sh
some awesome text with email *****
```
```js
import SensitiveInfo from 'remove-sensitive-info'
initialization(){
sensitiveinfo = new SensitiveInfo({
pattern: '####',
nodefaults: true,
regex: {
regex1: 'hello'
}
});
}
method(){
console.log(si.parse(['hello pavankumar8545@gmail.com', 'hello pavankumar8545@gmail.com']));}
```
output:
```sh
[ "#### pavankumar8545@gmail.com", "#### pavankumar8545@gmail.com" ]
```
MIT © P D K Pavan Kumar
[![Build Status](https: