# mask-json

> Redacts values in objects.

Latest version **1.0.3** (published 2019-08-27) · SEE LICENSE IN LICENSE license · 0 weekly downloads

## Install

```sh
npm install mask-json
pnpm add mask-json
yarn add mask-json
bun add mask-json
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2019-08-27 |
| First published | 2015-11-26 |
| Weekly downloads | 0 |
| License | SEE LICENSE IN LICENSE |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=5.0.0 |
| Dependencies | 1 |
| Unpacked size | 8.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 9 |
| Author | Nuno Sousa |
| Maintainers | nunofgs |
| Keywords | mask, deep, mask-json, redact |

## Links

- npm: https://www.npmjs.com/package/mask-json
- Repository: https://github.com/nunofgs/mask-json
- Issues: https://github.com/nunofgs/mask-json/issues
- npm.io page: https://npm.io/package/mask-json

## Dependencies (1)

- [lodash](https://npm.io/package/lodash.md) ^4.17.4

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.0.3 (latest) — 2019-08-27
- 1.0.2 — 2017-07-18
- 1.0.1 — 2017-03-24
- 1.0.0 — 2017-03-23
- 0.0.1 — 2015-11-26

## README

# mask-json

Redacts values in objects. Useful when sending data to external logging services such as [Sentry](http://app.getsentry.com/).

## Status

[![npm version][npm-image]][downloads-url] [![npm downloads][downloads-image]][downloads-url] [![build status][workflow-image]][workflow-url]

## 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:

Option        | Default value  | Description
------------- | -------------- | -----------------------------------------------------
_ignoreCase_  | false          | Whether 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

```javascript
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

```javascript
$ npm test
```

## Release

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

## License

MIT

[downloads-image]: https://img.shields.io/npm/dm/mask-json.svg
[downloads-url]: https://npmjs.org/package/mask-json
[npm-image]: https://img.shields.io/npm/v/mask-json.svg
[npm-url]: https://npmjs.org/package/mask-json
[workflow-image]: https://github.com/nunofgs/mask-json/workflows/Node%20CI/badge.svg
[workflow-url]: https://github.com/nunofgs/mask-json/actions

---
_Source: https://npm.io/package/mask-json · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
