Skip to content

Commit 021f896

Browse files
committed
Merge branch 'joeyhipolito-master'
2 parents 023972e + 0406d27 commit 021f896

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

lib/index.js

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,22 +74,27 @@ 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
}
97+
9398
return data;
9499
};
95100

@@ -105,6 +110,7 @@ GitStats.prototype.getConfig = function (callback) {
105110
GitStats.prototype.initConfig = function (input, callback) {
106111

107112
var self = this;
113+
108114
if (Typpy(input, Function)) {
109115
callback = input;
110116
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)