<commit_before># gulp-merge-json
[![NPM Version](https://badge.fury.io/js/gulp-merge-json.svg)](https://www.npmjs.com/package/gulp-merge-json) [![Build Status](https://travis-ci.org/joshswan/gulp-merge-json.svg?branch=master)](https://travis-ci.org/joshswan/gulp-merge-json) [![Coverage Status](https://coveralls.io/repos/joshswan/gulp-merge-json/badge.svg?branch=master&service=github)](https://coveralls.io/github/joshswan/gulp-merge-json?branch=master) [![Dependency Status](https://david-dm.org/joshswan/gulp-merge-json.svg)](https://david-dm.org/joshswan/gulp-merge-json) [![Dev Dependency Status](https://david-dm.org/joshswan/gulp-merge-json/dev-status.svg)](https://david-dm.org/joshswan/gulp-merge-json#info=devDependencies)

A gulp plugin for deep-merging multiple JSON files into one file. Export as JSON or a node module.

## Usage

```javascript
gulp.src('jsonFiles/**/*.json')
	.pipe(merge(options))
	.pipe(gulp.dest('./dist'));
```

### Options

| Key | Type | Default | Description |
| ---- | ---- | ------- | ----------- |
| `fileName` | `String` | `combined.json` | Output filename |
| `edit` | `Function` | `json => json` | Edit function (add/remove/edit keys during merge) |
| `startObj` | `Object/Array` | `{}` | Starting object to merge into (useful for providing default values) |
| `endObj` | `Object/Array` | | Object to merge after file merging complete (useful for overwriting with special values) |
| `exportModule` | `Boolean/String` | `false` | Output `module.exports = {MERGED_JSON_DATA};` or `{exportModule} = {MERGED_JSON_DATA}` when string passed |
| `concatArrays` | `Boolean` | `false` | Whether to concatenate arrays instead of merging |
| `mergeArrays` | `Boolean` | `true` | Whether to merge arrays or overwrite completely |
| `jsonReplacer` | `Function` | | Custom JSON replacer function passed to stringify |
| `jsonSpace` | `String` | `\t` | String used for white space by stringify |
| `json5` | `Boolean` | `false` | Use JSON5 instead of JSON for parse and stringify |

## Examples<commit_msg>Update README with customizer option<commit_after># gulp-merge-json
[![NPM Version](https://badge.fury.io/js/gulp-merge-json.svg)](https://www.npmjs.com/package/gulp-merge-json) [![Build Status](https://travis-ci.org/joshswan/gulp-merge-json.svg?branch=master)](https://travis-ci.org/joshswan/gulp-merge-json) [![Coverage Status](https://coveralls.io/repos/joshswan/gulp-merge-json/badge.svg?branch=master&service=github)](https://coveralls.io/github/joshswan/gulp-merge-json?branch=master) [![Dependency Status](https://david-dm.org/joshswan/gulp-merge-json.svg)](https://david-dm.org/joshswan/gulp-merge-json) [![Dev Dependency Status](https://david-dm.org/joshswan/gulp-merge-json/dev-status.svg)](https://david-dm.org/joshswan/gulp-merge-json#info=devDependencies)

A gulp plugin for deep-merging multiple JSON files into one file. Export as JSON or a node module.

## Usage

```javascript
gulp.src('jsonFiles/**/*.json')
	.pipe(merge(options))
	.pipe(gulp.dest('./dist'));
```

### Options

| Key | Type | Default | Description |
| ---- | ---- | ------- | ----------- |
| `fileName` | `String` | `combined.json` | Output filename |
| `edit` | `Function` | `json => json` | Edit function (add/remove/edit keys during merge) |
| `startObj` | `Object/Array` | `{}` | Starting object to merge into (useful for providing default values) |
| `endObj` | `Object/Array` | | Object to merge after file merging complete (useful for overwriting with special values) |
| `exportModule` | `Boolean/String` | `false` | Output `module.exports = {MERGED_JSON_DATA};` or `{exportModule} = {MERGED_JSON_DATA}` when string passed |
| `concatArrays` | `Boolean` | `false` | Whether to concatenate arrays instead of merging |
| `mergeArrays` | `Boolean` | `true` | Whether to merge arrays or overwrite completely |
| `customizer` | `Function` | | Custom merge function for use with [`mergeWith`](https://lodash.com/docs/#mergeWith) |
| `jsonReplacer` | `Function` | | Custom JSON replacer function passed to stringify |
| `jsonSpace` | `String` | `\t` | String used for white space by stringify |
| `json5` | `Boolean` | `false` | Use JSON5 instead of JSON for parse and stringify |

## Examples
{'fraction_non_alphanumeric': 0.18311195445920303, 'fraction_numerical': 0.0009487666034155598, 'mean_word_length': 4.637700534759358, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 21, 'lorem ipsum': 0, 'www.': 2, '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': '3449746', 'n_tokens_mistral': 1440, 'n_tokens_neox': 1402, 'n_words': 306}