Code formatting with 2 space indent
This commit is contained in:
+17
-17
@@ -8,24 +8,24 @@ const fs = require('fs');
|
||||
* @returns {*}
|
||||
*/
|
||||
const merge = (ref, src) => {
|
||||
if (typeof ref !== typeof src) {
|
||||
return ref;
|
||||
} else if (typeof ref === 'object') {
|
||||
const out = {};
|
||||
Object.keys(ref).forEach((key) =>out[key] = merge(ref[key], src[key]));
|
||||
return out;
|
||||
} else {
|
||||
return src;
|
||||
}
|
||||
if (typeof ref !== typeof src) {
|
||||
return ref;
|
||||
} else if (typeof ref === 'object') {
|
||||
const out = {};
|
||||
Object.keys(ref).forEach((key) => out[key] = merge(ref[key], src[key]));
|
||||
return out;
|
||||
} else {
|
||||
return src;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = () => {
|
||||
try {
|
||||
let configData = fs.readFileSync('config.json', {encoding:'UTF-8'});
|
||||
let config = JSON.parse(configData);
|
||||
return merge(refConfig, config);
|
||||
} catch (error) {
|
||||
console.error('Failed to load config.json : '+error);
|
||||
return refConfig;
|
||||
}
|
||||
try {
|
||||
let configData = fs.readFileSync('config.json', {encoding: 'UTF-8'});
|
||||
let config = JSON.parse(configData);
|
||||
return merge(refConfig, config);
|
||||
} catch (error) {
|
||||
console.error('Failed to load config.json : ' + error);
|
||||
return refConfig;
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user