11var jsbeautify = require ( 'js-beautify' ) . js_beautify ;
2- var merge = require ( 'deepmerge' ) ;
2+ var deepmerge = require ( 'deepmerge' ) ;
33var through = require ( 'through2' ) ;
44var PluginError = require ( 'plugin-error' ) ;
55var detectIndent = require ( 'detect-indent' ) ;
66
7- module . exports = function ( editor , jsbeautifyOptions , mergeOptions ) {
8-
7+ module . exports = function ( editor , jsbeautifyOptions , deepmergeOptions ) {
98
109 /*
11- * extras merge options
12- * this options is only pass to deepmerge
10+ * deepmerge options
1311 */
14- mergeOptions = mergeOptions || { } ;
12+ deepmergeOptions = deepmergeOptions || { } ;
1513
1614 /*
1715 * create 'editBy' function from 'editor'
@@ -23,7 +21,7 @@ module.exports = function (editor, jsbeautifyOptions, mergeOptions) {
2321 }
2422 else if ( typeof editor === 'object' ) {
2523 // edit JSON object by merging with user specific object
26- editBy = function ( json ) { return merge ( json , editor , mergeOptions ) ; } ;
24+ editBy = function ( json ) { return deepmerge ( json , editor , deepmergeOptions ) ; } ;
2725 }
2826 else if ( typeof editor === 'undefined' ) {
2927 throw new PluginError ( 'gulp-json-editor' , 'missing "editor" option' ) ;
@@ -59,7 +57,7 @@ module.exports = function (editor, jsbeautifyOptions, mergeOptions) {
5957 var indent = detectIndent ( file . contents . toString ( 'utf8' ) ) ;
6058
6159 // beautify options for this particular file
62- var beautifyOptions = merge ( { } , jsbeautifyOptions ) ; // make copy
60+ var beautifyOptions = deepmerge ( { } , jsbeautifyOptions ) ; // make copy
6361 beautifyOptions . indent_size = beautifyOptions . indent_size || indent . amount || 2 ;
6462 beautifyOptions . indent_char = beautifyOptions . indent_char || ( indent . type === 'tab' ? '\t' : ' ' ) ;
6563 beautifyOptions . beautify = ! ( 'beautify' in beautifyOptions && ! beautifyOptions . beautify ) ;
0 commit comments