Socket
Socket
Sign inDemoInstall

mask-json

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mask-json

Redacts values in objects.


Version published
Weekly downloads
9.3K
increased by0.75%
Maintainers
1
Weekly downloads
 
Created
Source

mask-json

Redacts values in objects. Useful when sending data to external logging services such as Sentry.

Status

npm version npm downloads build status

Installation

Install the package via npm:

$ npm install mask-json

Usage

Arguments

  1. collection (Array): An array of keys to redact.
  2. [options] (Object): An optional object with the following options:
OptionDefault valueDescription
ignoreCasefalseWhether to ignore case sensitivity when matching keys
replacement--REDACTED--The default value to replace

Returns

(Function): Returns a function that will redact values from a given object.

Example

var blacklist = ['password', 'username'];
var maskJson = require('mask-json')(blacklist);

maskJson({ foo: 'bar', biz: { username: 'myusername', password: 'mypassword' } });

// => { foo: 'bar', biz: { username: '--REDACTED--', password: '--REDACTED--' } }

Tests

$ npm test

Release

npm version [<new version> | major | minor | patch] -m "Release %s"

License

MIT

Keywords

FAQs

Package last updated on 27 Aug 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc