diff --git a/lib/utils.js b/lib/utils.js index 28d07c0..7accf77 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -84,7 +84,9 @@ var Utils = module.exports = { // // Returns subclass subclass: function subclass(child, parent) { - var ctor = function() { this.constructor = child; }; + var ctor = function() { + this.constructor = child; + }; for (var key in parent) { if (Object.hasOwnProperty.call(parent, key)) { @@ -109,8 +111,13 @@ var Utils = module.exports = { // // Returns base proxyFunctionsToObject: function proxyFunctionsToObject(methods, target, base, force) { - if (base == null) { base = this; } - if (force == null) { force = false; } + if (base == null) { + base = this; + } + + if (force == null) { + force = false; + } var fn = function(method) { return base[method] = function() { @@ -121,8 +128,9 @@ var Utils = module.exports = { for (var i = 0; i < methods.length; i++) { var method = methods[i]; - if (!force) { - if (typeof base[method] === 'function') { continue; } + + if (!force && typeof(base[method]) === 'function') { + continue; } fn(method); @@ -138,10 +146,15 @@ var Utils = module.exports = { // // Returns base proxyTestStubs: function proxyTestStubs(methods, base) { - if (base == null) { base = this; } + if (base == null) { + base = this; + } methods.forEach(function(method) { - base[method] = function() { return true; }; + base[method] = function() { + return true; + }; + base.commandList.push(method); }); @@ -165,7 +178,9 @@ var Utils = module.exports = { // // Returns a function wrapper bind: function bind(fn, me) { - return function() { return fn.apply(me, arguments); }; + return function() { + return fn.apply(me, arguments); + }; }, // Public: Adds necessary utils to global namespace, along with base class