<commit_before># Objfuscate

[![build status](https://secure.travis-ci.org/mongodb-js/objfuscate.png)](http://travis-ci.org/mongodb-js/objfuscate)

Redacts javascript object values recursively, and keys if desired.

## Installation

```
npm install -g objfuscate
```

## Usage

```
Usage:
   objfuscate [options] <jsonfile>
   objfuscate --version
   objfuscate -h | --help

Options:
   -h, --help           Print this help screen
   -k, --include-keys   Obfuscate keys as well
```

##### Use with a JSON file

```
objfuscate ./sensitive.json
```

Note: The file needs to be a single JSON object, or an array of JSON objects.
One JSON object per line without surrounding array brackets will not work.
If you export data from MongoDB with `mongoexport`, use the `--jsonArray` option
to create an array of objects.

##### Use with JSON string
```
objfuscate '{"my": "secret"}'
```

Note: You need to wrap the JSON string in single quotes and you need to write
proper JSON, which includes double quotes around key names and strings.

## License

Apache 2.0<commit_msg>added obfuscation details to README.<commit_after># Objfuscate

[![build status](https://secure.travis-ci.org/mongodb-js/objfuscate.png)](http://travis-ci.org/mongodb-js/objfuscate)

Redacts javascript object values recursively, and keys if desired.

## Installation

```
npm install -g objfuscate
```

## Usage

```
Usage:
   objfuscate [options] <jsonfile>
   objfuscate --version
   objfuscate -h | --help

Options:
   -h, --help           Print this help screen
   -k, --include-keys   Obfuscate keys as well
```

##### Use with a JSON file

```
objfuscate ./sensitive.json
```

Note: The file needs to be a single JSON object, or an array of JSON objects.
One JSON object per line without surrounding array brackets will not work.
If you export data from MongoDB with `mongoexport`, use the `--jsonArray` option
to create an array of objects.

##### Use with JSON string
```
objfuscate '{"my": "secret"}'
```

Note: You need to wrap the JSON string in single quotes and you need to write
proper JSON, which includes double quotes around key names and strings.

## Value Obfuscation

Currently, only the following values are replaced:

- Strings
- Numbers
- Booleans

Strings use a cache so that each string is replaced with the same random string,
which is created when a particular string is first encountered. This ensures
that the dataset has the same cardinality as the original.

## Key Obfuscation

To replace object keys as well, use the `-k` or `--include-keys` option like so:

```
objfuscate -k ./paranoid.json
objfuscate --include-keys ./paranoid.json
```

They key cache is the same as the value cache for strings (see above). A key
named `"foo"` is replaced with the same new string as the value `"foo"`.

## License

Apache 2.0
{'fraction_non_alphanumeric': 0.1056563500533618, 'fraction_numerical': 0.001422981145499822, 'mean_word_length': 3.75, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2668055', 'n_tokens_mistral': 903, 'n_tokens_neox': 854, 'n_words': 365}