Skip to content

Commit 0208b82

Browse files
committed
⬆️ 2.7.0
Fixed the getConfig method error sending.
1 parent 023972e commit 0208b82

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

lib/index.js

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -74,23 +74,26 @@ GitStats.DEFAULT_CONFIG = {
7474
* @return {Object|Undefined} If no callback is provided, the configuration object will be returned.
7575
*/
7676
GitStats.prototype.getConfig = function (callback) {
77-
var data = null;
77+
var data = {}
78+
, err = null
79+
;
80+
7881
try {
7982
data = require(CONFIG_PATH);
8083
} catch (err) {
81-
if (err.code !== "MODULE_NOT_FOUND") {
82-
if (callback) {
83-
return callback(err);
84-
} else {
85-
throw err;
86-
}
84+
if (err.code === "MODULE_NOT_FOUND") {
85+
err = null;
86+
data = {};
8787
}
88-
return {};
8988
}
89+
9090
if (callback) {
91-
callback(null, data);
91+
return callback(err, data);
92+
} else {
93+
if (err) {
94+
throw err;
95+
}
9296
}
93-
return data;
9497
};
9598

9699
/**
@@ -105,6 +108,7 @@ GitStats.prototype.getConfig = function (callback) {
105108
GitStats.prototype.initConfig = function (input, callback) {
106109

107110
var self = this;
111+
108112
if (Typpy(input, Function)) {
109113
callback = input;
110114
input = null;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "git-stats",
3-
"version": "2.6.0",
3+
"version": "2.7.0",
44
"description": "Local git statistics including GitHub-like contributions calendars.",
55
"main": "lib/index.js",
66
"bin": {

0 commit comments

Comments
 (0)