Remove nativeMax and nativeMin use from _.clamp.

This commit is contained in:
John-David Dalton
2015-10-23 16:25:22 -07:00
parent 2bf80673ae
commit cabd4198b0

View File

@@ -10986,17 +10986,22 @@
* // => 5 * // => 5
*/ */
function clamp(number, min, max) { function clamp(number, min, max) {
number = +number;
if (number === number) {
if (max === undefined) { if (max === undefined) {
max = min; max = min;
min = undefined; min = undefined;
} }
if (max !== undefined) { if (max !== undefined) {
max = +max; max = +max;
number = nativeMin(number, max === max ? max : 0); max = max === max ? max : 0;
number = number <= max ? number : max;
} }
if (min !== undefined) { if (min !== undefined) {
min = +min; min = +min;
number = nativeMax(number, min === min ? min : 0); min = min === min ? min : 0;
number = number >= min ? number : min;
}
} }
return number; return number;
} }