Skip to content

Commit 4e5089f

Browse files
author
Veeck
committed
Update dependencies, fix tests
1 parent 2a78eb8 commit 4e5089f

File tree

5 files changed

+213
-197
lines changed

5 files changed

+213
-197
lines changed

.gitattributes

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# text files detection
2+
* text=auto
3+
4+
# unix end of lines forcing for text files
5+
* text eol=lf

index.js

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ var through = require('through2');
44
var PluginError = require('plugin-error');
55
var detectIndent = require('detect-indent');
66

7-
module.exports = function (editor, jsbeautifyOptions, deepmergeOptions) {
7+
module.exports = function(editor, jsbeautifyOptions, deepmergeOptions) {
88

99
/*
1010
* deepmerge options
1111
*/
12-
deepmergeOptions = deepmergeOptions || {};
12+
deepmergeOptions = deepmergeOptions || {};
1313

1414
/*
1515
* create 'editBy' function from 'editor'
@@ -18,15 +18,12 @@ module.exports = function (editor, jsbeautifyOptions, deepmergeOptions) {
1818
if (typeof editor === 'function') {
1919
// edit JSON object by user specific function
2020
editBy = function(json) { return editor(json); };
21-
}
22-
else if (typeof editor === 'object') {
21+
} else if (typeof editor === 'object') {
2322
// edit JSON object by merging with user specific object
2423
editBy = function(json) { return deepmerge(json, editor, deepmergeOptions); };
25-
}
26-
else if (typeof editor === 'undefined') {
24+
} else if (typeof editor === 'undefined') {
2725
throw new PluginError('gulp-json-editor', 'missing "editor" option');
28-
}
29-
else {
26+
} else {
3027
throw new PluginError('gulp-json-editor', '"editor" option must be a function or object');
3128
}
3229

@@ -38,7 +35,7 @@ module.exports = function (editor, jsbeautifyOptions, deepmergeOptions) {
3835
/*
3936
* create through object and return it
4037
*/
41-
return through.obj(function (file, encoding, callback) {
38+
return through.obj(function(file, encoding, callback) {
4239

4340
// ignore it
4441
if (file.isNull()) {
@@ -72,8 +69,7 @@ module.exports = function (editor, jsbeautifyOptions, deepmergeOptions) {
7269

7370
// write it to file
7471
file.contents = Buffer.from(json);
75-
}
76-
catch (err) {
72+
} catch (err) {
7773
this.emit('error', new PluginError('gulp-json-editor', err));
7874
}
7975

0 commit comments

Comments
 (0)