{"ScriptPreparationCode":null,"TestCases":[{"Name":"chunks_yield","Code":"function chunks_yield(array, size) {\r\n function* chunk(arr, n) {\r\n for (let i = 0; i \u003C arr.length; i \u002B= n) {\r\n yield arr.slice(i, i \u002B n);\r\n }\r\n }\r\n return [...chunk(array, size)];\r\n}","IsDeferred":false},{"Name":"chunks_perf","Code":"function chunks(arr, n) {\r\n return arr.reduce((chunk, val) =\u003E {\r\n\r\n if (chunk[chunk.length - 1].length === n)\r\n chunk.push([]);\r\n\r\n chunk[chunk.length - 1].push(val);\r\n\r\n return chunk;\r\n }, [\r\n []\r\n ]);\r\n}","IsDeferred":false}]}