{"ScriptPreparationCode":"const clamp = (number, boundOne, boundTwo) =\u003E {\r\n if (!boundTwo) {\r\n return Math.max(number, boundOne) === boundOne ? number : boundOne;\r\n } else if (Math.min(number, boundOne) === number) {\r\n return boundOne;\r\n } else if (Math.max(number, boundTwo) === number) {\r\n return boundTwo;\r\n }\r\n return number;\r\n};","TestCases":[{"Name":"Lodash clamp","Code":"_.clamp(150, 10, 100); ","IsDeferred":false},{"Name":"Manual Math.min Math.max","Code":"Math.min(Math.max(150, 10), 100);","IsDeferred":false},{"Name":"Conditional Math clamp","Code":"((number = 150, boundOne = 10, boundTwo = 100) =\u003E {\r\n if (!boundTwo) {\r\n return Math.max(number, boundOne) === boundOne ? number : boundOne;\r\n } else if (Math.min(number, boundOne) === number) {\r\n return boundOne;\r\n } else if (Math.max(number, boundTwo) === number) {\r\n return boundTwo;\r\n }\r\n return number;\r\n})();","IsDeferred":false}]}