Package Exports
- remove-sensitive-info
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (remove-sensitive-info) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
remove-sensitive-info
Installation
Install remove-sensitive-info
into to your project via npm
:
$ npm install remove-sensitive-info --save-dev
Usage
new SensitiveInfo(config).parse(text) --- returns parsed text replacing all the sensitivie info (email, ssn, phone)
config:Object
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
}
}
example1:
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:
some awesome text with email *****
example2:
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:
[ "#### pavankumar8545@gmail.com", "#### pavankumar8545@gmail.com" ]
License
MIT © P D K Pavan Kumar