0xmtn / hide-secrets

for when you want to log an object but hide certain restricted fields, e.g., password

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

hide-secrets

Build Status Coverage Status NPM version js-standard-style

var hide = require('hide-secrets')

var obj = {
  innerObject: {
    password: 'abc123',
    email: 'ben@npmjs.com',
    token: 'my-secret-token'
  },
  auth: '' // empty strings are left empty.
}

console.log(hide(obj))

outputs

{
  innerObject: {
    password: '[SECRET]',
    email: 'ben@npmjs.com',
    token: '[SECRET]'
  },
  auth: ''
}

Currently the following fields are obfuscated:

password, pass, token, auth, secret, passphrase.

License

ISC

About

for when you want to log an object but hide certain restricted fields, e.g., password

License:ISC License


Languages

Language:JavaScript 100.0%