{"ScriptPreparationCode":"var reduce = (vals) =\u003E {\r\n return Object.entries(colors).reduce( (prev, [key, value]) =\u003E {\r\n /** Values need to be strings that are valid CSS colors */\r\n if (!value\r\n || typeof value !== \u0022string\u0022 \r\n || !CSS.supports(\u0022color\u0022, value)\r\n ) {\r\n throw new TypeError(\u0060Expected valid CSS color; not ${value}\u0060);\r\n }\r\n\r\n prev[key] = value;\r\n return prev;\r\n }, {});\r\n}\r\n\r\nvar spread = (vals) =\u003E {\r\n for (const k in vals) {\r\n const value = vals[k]\r\n if (!value\r\n || typeof value !== \u0022string\u0022 \r\n || !CSS.supports(\u0022color\u0022, value)\r\n\t) {\r\n\t\tthrow new TypeError(\u0060Expected valid CSS color; not ${value}\u0060);\r\n\t}\r\n }\r\n return {...vals}\r\n}\r\n\r\n\r\nvar colors = {\r\n \u0022hood\u0022: \u0022rgb(161, 33, 148)\u0022,\r\n \u0022frontbumper\u0022: \u0022rgb(62, 237, 63)\u0022,\r\n \u0022fenderL\u0022: \u0022rgb(118, 208, 242)\u0022,\r\n \u0022door1L\u0022: \u0022rgb(255, 2, 66)\u0022,\r\n \u0022door2L\u0022: \u0022rgb(120, 69, 181)\u0022,\r\n \u0022sideframeL\u0022: \u0022rgb(211, 191, 91)\u0022,\r\n \u0022roof\u0022: \u0022rgb(81, 163, 226)\u0022,\r\n \u0022sideskirtL\u0022: \u0022rgb(23, 183, 150)\u0022,\r\n \u0022door1R\u0022: \u0022rgb(157, 64, 99)\u0022,\r\n \u0022fenderR\u0022: \u0022rgb(2, 48, 26)\u0022,\r\n \u0022door2R\u0022: \u0022rgb(139, 19, 179)\u0022,\r\n \u0022sideskirtR\u0022: \u0022rgb(141, 59, 133)\u0022,\r\n \u0022sideframeR\u0022: \u0022rgb(49, 97, 193)\u0022,\r\n \u0022backbumper\u0022: \u0022rgb(223, 68, 155)\u0022,\r\n \u0022tailgate\u0022: \u0022rgb(204, 28, 50)\u0022,\r\n};","TestCases":[{"Name":"copy via reduce","Code":"const new_colors = reduce(colors)","IsDeferred":false},{"Name":"copy via spread","Code":"const new_colors = spread(colors)","IsDeferred":false}]}