{"ScriptPreparationCode":"const use = (a, fn) =\u003E fn(a);\r\n\r\nconst isFunc = (v) =\u003E typeof v === \u0027function\u0027;\r\n\r\nconst isDefined = v =\u003E v !== undefined \u0026\u0026 v !== null;\r\n\r\nconst switchEnum = (e, handlers) =\u003E use(handlers[e] || handlers.else, fn =\u003E isFunc(fn) ? fn(e) : e);\r\n\r\nfunction normal(inp) {\r\n switch (inp) {\r\n case \u0022today\u0022:\r\n return 1;\r\n case \u0022tomorrow\u0022:\r\n return 2;\r\n case \u0022yesterday\u0022:\r\n return -1;\r\n default:\r\n return 0;\t\r\n }\r\n};\r\n\r\nfunction funcccy(inp) {\r\n return switchEnum(inp, {\r\n \u0022today\u0022: () =\u003E 1,\r\n \u0022tomorrow\u0022: () =\u003E 2,\r\n \u0022yesterday\u0022: () =\u003E -1,\r\n \u0022else\u0022: () =\u003E 0,\r\n });\r\n}","TestCases":[{"Name":"Vanilla Switch","Code":"\r\nnormal(\u0027today\u0027);\r\nnormal(\u0027yesterday\u0027);\r\nnormal(\u0027tomorrow\u0027);","IsDeferred":false},{"Name":"Switch Fn style","Code":"funcccy(\u0027today\u0027);\r\nfuncccy(\u0027yesterday\u0027);\r\nfuncccy(\u0027tomorrow\u0027);","IsDeferred":false}]}