{"ScriptPreparationCode":"function wrap(fn) {\r\n // fast path if arity \u003C 4, slow path if not\r\n switch (fn.length) {\r\n case 0:\r\n return function() {\r\n return fn.call(this)\r\n }\r\n case 1:\r\n return function() {\r\n return fn.call(this, this)\r\n }\r\n case 2:\r\n return function(a1) {\r\n return fn.call(this, this, a1)\r\n }\r\n case 3:\r\n return function(a1, a2) {\r\n return fn.call(this, this, a1, a2)\r\n }\r\n case 4:\r\n return function(a1, a2, a3) {\r\n return fn.call(this, this, a1, a2, a3)\r\n }\r\n default:\r\n return function() {\r\n const args = [this]\r\n for (let i = 0, len = arguments.length; i \u003C len; i\u002B\u002B) {\r\n args[i \u002B 1] = arguments[i]\r\n }\r\n return fn.apply(this, args)\r\n }\r\n }\r\n}\r\n\r\nvar f0 = wrap(function() { console.log(Date.now()) })\r\nvar f1 = wrap(function(a) { console.log(Date.now(), a) })\r\nvar f2 = wrap(function(a, b) { console.log(Date.now(), a, b) })\r\nvar f3 = wrap(function(a, b, c) { console.log(Date.now(), a, b, c) })\r\nvar f4 = wrap(function(a, b, c, d) { console.log(Date.now(), a, b, c, d) })\r\nvar f5 = wrap(function(a, b, c, d, e) { console.log(Date.now(), a, b, c, d, e) })","TestCases":[{"Name":"With 0 parameter","Code":"f0()","IsDeferred":false},{"Name":"With 1 parameter","Code":"f1(Date.now)","IsDeferred":false},{"Name":"With 2 parameters","Code":"f2(Date.now, Date.now \u002B 1)","IsDeferred":false},{"Name":"With 3 parameters","Code":"f3(Date.now, Date.now \u002B 1, Date.now \u002B 2)","IsDeferred":false},{"Name":"With 4 parameters","Code":"f4(Date.now, Date.now \u002B 1, Date.now \u002B 2, Date.now \u002B 3)","IsDeferred":false},{"Name":"With 5 parameters","Code":"f5(Date.now, Date.now \u002B 1, Date.now \u002B 2, Date.now \u002B 3, Date.now \u002B 4)","IsDeferred":false}]}