Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

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.

  • 1.0.1
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
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 24 Mar 2017

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