Move undefined check to the constructor.
This commit is contained in:
parent
db2ee2ab27
commit
cc1cbc12ad
12
lib/index.js
12
lib/index.js
@ -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) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user