{"ScriptPreparationCode":"var obj = {};\r\n\r\nfor (i = 1000; i \u003E 0; i--) {\r\n if (i%2 == 0) {\r\n \tobj[i] = \u0027String\u0027;\r\n } else {\r\n obj[i] = [ \u0027Array of String\u0027, \u0027Array of String\u0027 ];\r\n }\r\n}\r\n\r\n","TestCases":[{"Name":"forEach","Code":"function ClassList(collection={}) {\r\n const classNames = {};\r\n const keys = Object.keys(collection);\r\n\r\n keys.forEach((key) =\u003E {\r\n const innerCollection = collection[key];\r\n const collectionCheck = Object.prototype.toString.call(innerCollection);\r\n\r\n switch (collectionCheck) {\r\n case \u0027[object Object]\u0027: {\r\n const innerKeys = Object.keys(innerCollection);\r\n\r\n if (innerKeys.length === 0) {\r\n classNames[key] = \u0027\u0027;\r\n break;\r\n }\r\n\r\n let classList = [];\r\n innerKeys.forEach((innerKey) =\u003E {\r\n if (!innerCollection[innerKey] || !innerCollection[innerKey].length) {\r\n return;\r\n }\r\n\r\n const innerCollectionCheck = Object.prototype.toString.call(innerCollection[innerKey]);\r\n switch (innerCollectionCheck) {\r\n case \u0027[object Array]\u0027:\r\n classList.push(...innerCollection[innerKey]);\r\n break;\r\n\r\n case \u0027[object String]\u0027:\r\n classList.push(innerCollection[innerKey]);\r\n break;\r\n }\r\n });\r\n\r\n classNames[key] = classList.reduce((acc, cl) =\u003E (acc \u002B= cl \u002B \u0027 \u0027), \u0027\u0027);\r\n break;\r\n }\r\n\r\n case \u0027[object Array]\u0027:\r\n classNames[key] = innerCollection.reduce((acc, cl) =\u003E (acc \u002B= cl \u002B \u0027 \u0027), \u0027\u0027);\r\n break;\r\n\r\n case \u0027[object String]\u0027:\r\n classNames[key] = innerCollection;\r\n break;\r\n }\r\n });\r\n\r\n return classNames;\r\n}\r\n\r\nClassList( obj );","IsDeferred":false},{"Name":"for .. of","Code":"function ClassList(collection={}) {\r\n const classNames = {};\r\n const keys = Object.keys(collection);\r\n\r\n for (const key of keys) {\r\n if ( Object.prototype.hasOwnProperty.call(collection, key) ) {\r\n const innerCollection = collection[key];\r\n const collectionCheck = Object.prototype.toString.call(innerCollection);\r\n\r\n switch (collectionCheck) {\r\n case \u0027[object Object]\u0027: {\r\n const innerKeys = Object.keys(innerCollection);\r\n \r\n if (innerKeys.length === 0) {\r\n classNames[key] = \u0027\u0027;\r\n break;\r\n }\r\n \r\n let classList = [];\r\n innerKeysLoop: for (const innerKey of innerKeys) {\r\n if (!innerCollection[innerKey] || !innerCollection[innerKey].length) {\r\n continue innerKeysLoop;\r\n }\r\n \r\n const innerCollectionCheck = Object.prototype.toString.call(innerCollection[innerKey]);\r\n switch (innerCollectionCheck) {\r\n case \u0027[object Array]\u0027:\r\n classList.push(...innerCollection[innerKey]);\r\n break;\r\n \r\n case \u0027[object String]\u0027:\r\n classList.push(innerCollection[innerKey]);\r\n break;\r\n }\r\n }\r\n \r\n classNames[key] = classList.reduce((acc, cl) =\u003E (acc \u002B= cl \u002B \u0027 \u0027), \u0027\u0027);\r\n break;\r\n }\r\n \r\n case \u0027[object Array]\u0027:\r\n classNames[key] = innerCollection.reduce((acc, cl) =\u003E (acc \u002B= cl \u002B \u0027 \u0027), \u0027\u0027);\r\n break;\r\n \r\n case \u0027[object String]\u0027:\r\n classNames[key] = innerCollection;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n return classNames;\r\n}\r\n\r\nClassList( obj );","IsDeferred":false}]}