Skip to content

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

License

Notifications You must be signed in to change notification settings

nason/hide-secrets

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%