@@ -4,12 +4,12 @@ var through = require('through2');
4
4
var PluginError = require ( 'plugin-error' ) ;
5
5
var detectIndent = require ( 'detect-indent' ) ;
6
6
7
- module . exports = function ( editor , jsbeautifyOptions , deepmergeOptions ) {
7
+ module . exports = function ( editor , jsbeautifyOptions , deepmergeOptions ) {
8
8
9
9
/*
10
10
* deepmerge options
11
11
*/
12
- deepmergeOptions = deepmergeOptions || { } ;
12
+ deepmergeOptions = deepmergeOptions || { } ;
13
13
14
14
/*
15
15
* create 'editBy' function from 'editor'
@@ -18,15 +18,12 @@ module.exports = function (editor, jsbeautifyOptions, deepmergeOptions) {
18
18
if ( typeof editor === 'function' ) {
19
19
// edit JSON object by user specific function
20
20
editBy = function ( json ) { return editor ( json ) ; } ;
21
- }
22
- else if ( typeof editor === 'object' ) {
21
+ } else if ( typeof editor === 'object' ) {
23
22
// edit JSON object by merging with user specific object
24
23
editBy = function ( json ) { return deepmerge ( json , editor , deepmergeOptions ) ; } ;
25
- }
26
- else if ( typeof editor === 'undefined' ) {
24
+ } else if ( typeof editor === 'undefined' ) {
27
25
throw new PluginError ( 'gulp-json-editor' , 'missing "editor" option' ) ;
28
- }
29
- else {
26
+ } else {
30
27
throw new PluginError ( 'gulp-json-editor' , '"editor" option must be a function or object' ) ;
31
28
}
32
29
@@ -38,7 +35,7 @@ module.exports = function (editor, jsbeautifyOptions, deepmergeOptions) {
38
35
/*
39
36
* create through object and return it
40
37
*/
41
- return through . obj ( function ( file , encoding , callback ) {
38
+ return through . obj ( function ( file , encoding , callback ) {
42
39
43
40
// ignore it
44
41
if ( file . isNull ( ) ) {
@@ -72,8 +69,7 @@ module.exports = function (editor, jsbeautifyOptions, deepmergeOptions) {
72
69
73
70
// write it to file
74
71
file . contents = Buffer . from ( json ) ;
75
- }
76
- catch ( err ) {
72
+ } catch ( err ) {
77
73
this . emit ( 'error' , new PluginError ( 'gulp-json-editor' , err ) ) ;
78
74
}
79
75
0 commit comments