{"ScriptPreparationCode":"var obj = {};\r\n\r\nfor (i = 1000; i \u003E 0; i--) {\r\n \tobj[i] = {\r\n container: {\r\n sm: {\r\n layout: [\u0027p-4\u0027],\r\n presentation: \u0027bg-blue-100\u0027,\r\n },\r\n md: [\u0027md:bg-green-100\u0027, \u0027md:p-6\u0027],\r\n lg: [\u0027lg:bg-yellow-100\u0027, \u0027lg:p-8\u0027],\r\n xl: [\u0027xl:bg-red-100\u0027, \u0027xl:p-10\u0027],\r\n xxl: \u0027xxl:bg-gray-100 xxl:p-12\u0027,\r\n },\r\n heading: {\r\n sm: [ \u0027bg-yellow-200\u0027, \u0027md:bg-green-200\u0027 ],\r\n md: ( ()=\u003E \u0027md:bg-yellow-200\u0027 )(),\r\n },\r\n paragraph: [\u0027bg-gray-300\u0027,\u0027p-12\u0027],\r\n box: \u0027bg-yellow-400\u0027,\r\n button: {},\r\n };\r\n}\r\n","TestCases":[{"Name":"Recursive flatten v1","Code":"function ClassList(collection = {}) {\r\n const result = {};\r\n\r\n function flatten(node, str) {\r\n const nodeType = Object.prototype.toString.call(node);\r\n \r\n switch (nodeType) {\r\n case \u0027[object String]\u0027: {\r\n str \u002B= node \u002B \u0027 \u0027;\r\n break;\r\n }\r\n case \u0027[object Array]\u0027: {\r\n str \u002B= node.join(\u0027 \u0027) \u002B \u0027 \u0027;\r\n break;\r\n }\r\n case \u0027[object Object]\u0027: {\r\n for (const key in node) {\r\n str \u002B= flatten(node[key], \u0027\u0027);\r\n }\r\n break;\r\n }\r\n }\r\n \r\n return str;\r\n }\r\n\r\n for (const key in collection) {\r\n result[key] = flatten(collection[key], \u0027\u0027);\r\n }\r\n\r\n return result;\r\n}\r\n\r\nClassList(obj);","IsDeferred":false},{"Name":"Recursive flatten v2","Code":"function ClassList(collection = {}) {\r\n const result = {};\r\n\r\n function flatten(node, arr) {\r\n const nodeType = Object.prototype.toString.call(node);\r\n \r\n switch (nodeType) {\r\n case \u0027[object String]\u0027: {\r\n arr.push(node);\r\n break;\r\n }\r\n case \u0027[object Array]\u0027: {\r\n arr.push(...node);\r\n break;\r\n }\r\n case \u0027[object Object]\u0027: {\r\n for (const key in node) {\r\n flatten(node[key], arr);\r\n }\r\n break;\r\n }\r\n }\r\n \r\n return arr;\r\n }\r\n\r\n for (const key in collection) {\r\n result[key] = flatten(collection[key], []).join(\u0027 \u0027);\r\n }\r\n \r\n return result;\r\n}\r\n\r\nClassList(obj);","IsDeferred":false},{"Name":"Recursive flatten v3 (no spread)","Code":"function ClassList(collection = {}) {\r\n const result = {};\r\n\r\n function flatten(node, arr) {\r\n const nodeType = Object.prototype.toString.call(node);\r\n \r\n switch (nodeType) {\r\n case \u0027[object String]\u0027: {\r\n arr.push(node);\r\n break;\r\n }\r\n case \u0027[object Array]\u0027: {\r\n arr.push(node);\r\n break;\r\n }\r\n case \u0027[object Object]\u0027: {\r\n for (const key in node) {\r\n flatten(node[key], arr);\r\n }\r\n break;\r\n }\r\n }\r\n \r\n return arr;\r\n }\r\n\r\n for (const key in collection) {\r\n result[key] = flatten(collection[key], []).join(\u0027 \u0027);\r\n }\r\n \r\n return result;\r\n}\r\n\r\nClassList(obj);","IsDeferred":false}]}