Move undefined check to the constructor.

This commit is contained in:
Braydon Fuller 2015-10-13 11:15:46 -04:00
parent db2ee2ab27
commit cc1cbc12ad

View File

@ -25,7 +25,11 @@ var InsightAPI = function(options) {
inv: []
};
this.routePrefix = options.routePrefix;
if (!_.isUndefined(options.routePrefix)) {
this.routePrefix = options.routePrefix;
} else {
this.routePrefix = this.name;
}
this.txController = new TxController(this.node);
};
@ -35,11 +39,7 @@ InsightAPI.dependencies = ['address', 'web'];
inherits(InsightAPI, BaseService);
InsightAPI.prototype.getRoutePrefix = function() {
if (!_.isUndefined(this.routePrefix)) {
return this.routePrefix;
} else {
return this.name;
}
return this.routePrefix;
};
InsightAPI.prototype.start = function(callback) {