npm.io
1.0.2 • Published 6 years ago

log-sanitizer

Licence
ISC
Version
1.0.2
Deps
1
Size
4 kB
Vulns
0
Weekly
0

log-sanitizer

Description

Module that allows users to sanitize JSON data based on inputted fields, i.e. password, email, credit card information, etc.

Requirements

Installation
npm install log-sanitizer
Usage
  1. Import module
const Sanitize = require('log-sanitizer');
  1. Initialize object with array of fields to be sanitized
const logSanitizer = new Sanitize(['password'])
  1. Sanitize JSON object: Function takes in a JSON object and creates a deep copy that is sanitized based on the fields the user inputted during initialization and returned.
const sanitizedData = logSanitizer.sanitize({ "password": "helloWorld" });
//sanitizedData = { "password": "*" }