0.2.3 • Published 7 years ago

cnsr v0.2.3

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

cnsr

cnsr (pronunciation: censor) is a lightweight object masker for sensitive data written in functional approach with no side effects, no dependencies focused in NodeJS server logs data and fully configurable.

// mount or get your mounted object for your request or response
const reqData = { user: 'Vincent Vega', password: 'lovemia' };

// use a log tool that you like and if you want to print
// what is happening, just execute csnr with its arguments
yourLoggerTool.info(`${method} in ${uri} endpoint`, cnsr(reqData, ['password']));

// do the rest of your duties
...

Installation

$ npm install --save cnsr

Docs and usage

Require or import it to your file

const cnsr = require('cnsr');

cnsr needs two arguments, the first is your object and the second is an Array of string keys to be masked:

cnsr(object, maskable)

object: Your object to be iterated and masked based in maskable argument;

maskable: Array of strings you want to mask, example: ['password', 'auth_token'].

Example:

cnsr({ user: 'butch_coolidge', password: 'punch123' }, ['password']); // { user: 'butch_coolidge', password: '********' }
0.2.3

7 years ago

0.2.2

7 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.0

7 years ago