{"ScriptPreparationCode":"var cases = [\r\n { nx: undefined, ny: 12 },\r\n { ny: 12, nx: undefined },\r\n { nx: undefined, ny: undefined },\r\n { nx: 12, ny: 12 }\r\n]\r\nvar style = { transform: null }\r\n","TestCases":[{"Name":"Typical Code","Code":"for (const {nx, ny} of cases) {\r\n if (nx !== undefined || ny !== undefined) {\r\n style.transform = nx !== undefined\r\n ? (ny !== undefined\r\n ? \u0060translate(${nx}px, ${ny}px)\u0060\r\n : \u0060translateX(${nx}px)\u0060)\r\n : \u0060translateY(${ny}px)\u0060;\r\n }\r\n}\r\n","IsDeferred":false},{"Name":"Bit-shift","Code":"for (const {nx, ny} of cases) {\r\n const sx = nx !== undefined // state_x\r\n const sy = ny !== undefined // state_y\r\n \r\n const state = \r\n (sx \u0026\u0026 ! sy ? 1 : 0)\r\n \t| (sy \u0026\u0026 ! sx ? 2 : 0)\r\n | (sx \u0026\u0026 sy ? 4 : 0)\r\n | ( ! sx || ! sy ? 8 : 0)\r\n \r\n switch (state) {\r\n case 8: // neither\r\n style.transform = \u0027\u0027\r\n break\r\n case 4: // both\r\n style.transform = \u0060translate(${nx}px, ${ny}px)\u0060\r\n break\r\n case 2: // only y\r\n style.transform = \u0060translateY(${ny}px)\u0060\r\n break\r\n case 1: // only x\r\n style.transform = \u0060translateX(${nx}px)\u0060\r\n break;\r\n } \r\n}\r\n\r\n\r\n","IsDeferred":false}]}