secret-obfuscator
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

npm version

Secret Obfuscator

Replaces secrets in strings with "***".

Installation

npm install --save secret-obfuscator

or available on JSDelivr at "https://cdn.jsdelivr.net/npm/secret-obfuscator@1".

Usage

import { Obfuscator } from 'secret-obfuscator';
 
const obfuscator = new Obfuscator({
  secrets: ['abc', 'def', 'efg'],
  replacement: '***', // optional
});
 
obfuscator.obfuscate('This is a secret: abc');
// => This is a secret: ***
obfuscator.obfuscate('These are some secrets: abc def');
// => These are some secrets: *** ***
obfuscator.obfuscate('This is a mix of overlapping secrets: abcdefg');
// => This is a mix of overlapping secrets: ***

Package Sidebar

Install

npm i secret-obfuscator

Weekly Downloads

0

Version

1.0.3

License

MIT

Unpacked Size

15.6 kB

Total Files

21

Last publish

Collaborators

  • tjenkinson