From cc1cbc12adf416d875ee9eb04a16bea56c9f618b Mon Sep 17 00:00:00 2001 From: Braydon Fuller Date: Tue, 13 Oct 2015 11:15:46 -0400 Subject: [PATCH] Move undefined check to the constructor. --- lib/index.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/index.js b/lib/index.js index 870ca85..fa93386 100644 --- a/lib/index.js +++ b/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) {