{"ScriptPreparationCode":"var values = new Array(200 * 200 * 4);","TestCases":[{"Name":"lodash","Code":"const chunks = _.chunk(values, 4);","IsDeferred":false},{"Name":"you-dont-need","Code":"const chunk = (input, size) =\u003E {\r\n return input.reduce((arr, item, idx) =\u003E {\r\n return idx % size === 0\r\n ? [...arr, [item]]\r\n : [...arr.slice(0, -1), [...arr.slice(-1)[0], item]];\r\n }, []);\r\n};\r\n\r\nconst chunks = chunk(values, 4);","IsDeferred":false},{"Name":"youmightnotneed","Code":"const chunk = (arr, chunkSize = 1, cache = []) =\u003E {\r\n const tmp = [...arr]\r\n if (chunkSize \u003C= 0) return cache\r\n while (tmp.length) cache.push(tmp.splice(0, chunkSize))\r\n return cache\r\n}\r\n\r\nconst chunks = chunk(values, 4);","IsDeferred":false},{"Name":"custom","Code":"var chunks = [];\r\n\r\nfor (var i = 0; i \u003C values.length; i \u002B= 4) {\r\n chunks.push(values.slice(i, i \u002B 4));\r\n}","IsDeferred":false}]}