From be3c8275d480e843f49cb64179022b2e0a86059a Mon Sep 17 00:00:00 2001 From: Elliot Nelson Date: Thu, 6 Feb 2020 10:34:55 -0500 Subject: [PATCH] Tidy up SpyStrategy#exec --- src/core/SpyStrategy.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/core/SpyStrategy.js b/src/core/SpyStrategy.js index 43f89831..7e86abd6 100644 --- a/src/core/SpyStrategy.js +++ b/src/core/SpyStrategy.js @@ -97,14 +97,12 @@ getJasmineRequireObj().SpyStrategy = function(j$) { * @function */ SpyStrategy.prototype.exec = function(context, args, invokeNew) { - var list = [context].concat(args ? Array.prototype.slice.call(args) : []); - var target = this.plan.bind.apply(this.plan, list); + var contextArgs = [context].concat( + args ? Array.prototype.slice.call(args) : [] + ); + var target = this.plan.bind.apply(this.plan, contextArgs); - if (invokeNew) { - return new target(); - } else { - return target(); - } + return invokeNew ? new target() : target(); }; /**