{"ScriptPreparationCode":"const flow = (funcs) =\u003E {\r\n const length = funcs ? funcs.length : 0\r\n let index = length\r\n while (index--) {\r\n if (typeof funcs[index] != \u0027function\u0027) {\r\n throw new TypeError(\u0027Expected a function\u0027)\r\n }\r\n }\r\n return function (...args) {\r\n let index = 0\r\n let result = length ? funcs[index].apply(this, args) : args[0]\r\n while (\u002B\u002Bindex \u003C length) {\r\n result = funcs[index].call(this, result)\r\n }\r\n return result\r\n }\r\n}\r\n\r\nconst flew = (funcs) =\u003E {\r\n if(funcs.some(func =\u003E typeof func != \u0027function\u0027)) {\r\n throw new TypeError(\u0027Expected a function\u0027)\r\n }\r\n return (...args) =\u003E funcs.reduce((arg, fn, i) =\u003E i == 0 ? fn(...arg) : fn(arg), args)\r\n}\r\n\r\nconst add = (i, j) =\u003E i \u002B j\r\nconst mult = (_, i, j) =\u003E _ * i \r\nconst funcs = [add, mult.bind(this, 3)]\r\n\r\nfunction doFlow() {\r\n\treturn flow(funcs)(1,2)\r\n}\r\nfunction doFlew() {\r\n\treturn flew(funcs)(1,2)\r\n}","TestCases":[{"Name":"flow","Code":"var flowResult = 0;\r\nflowResult = doFlow();","IsDeferred":false},{"Name":"flew","Code":"var flewResult = 0;\r\nflewResult = doFlew();","IsDeferred":false}]}