mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-10 10:57:49 +00:00
Remove nativeMax and nativeMin use from _.clamp.
This commit is contained in:
27
lodash.js
27
lodash.js
@@ -10986,17 +10986,22 @@
|
|||||||
* // => 5
|
* // => 5
|
||||||
*/
|
*/
|
||||||
function clamp(number, min, max) {
|
function clamp(number, min, max) {
|
||||||
if (max === undefined) {
|
number = +number;
|
||||||
max = min;
|
if (number === number) {
|
||||||
min = undefined;
|
if (max === undefined) {
|
||||||
}
|
max = min;
|
||||||
if (max !== undefined) {
|
min = undefined;
|
||||||
max = +max;
|
}
|
||||||
number = nativeMin(number, max === max ? max : 0);
|
if (max !== undefined) {
|
||||||
}
|
max = +max;
|
||||||
if (min !== undefined) {
|
max = max === max ? max : 0;
|
||||||
min = +min;
|
number = number <= max ? number : max;
|
||||||
number = nativeMax(number, min === min ? min : 0);
|
}
|
||||||
|
if (min !== undefined) {
|
||||||
|
min = +min;
|
||||||
|
min = min === min ? min : 0;
|
||||||
|
number = number >= min ? number : min;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return number;
|
return number;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user