mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-10 19:07:49 +00:00
Enhance inRange with toNumber to allow binary and octal strings.
This commit is contained in:
committed by
John-David Dalton
parent
19e0650c4f
commit
1d58823405
@@ -11321,13 +11321,14 @@
|
|||||||
* // => true
|
* // => true
|
||||||
*/
|
*/
|
||||||
function inRange(number, start, end) {
|
function inRange(number, start, end) {
|
||||||
start = +start || 0;
|
start = toNumber(start) || 0;
|
||||||
if (end === undefined) {
|
if (end === undefined) {
|
||||||
end = start;
|
end = start;
|
||||||
start = 0;
|
start = 0;
|
||||||
} else {
|
} else {
|
||||||
end = +end || 0;
|
end = toNumber(end) || 0;
|
||||||
}
|
}
|
||||||
|
number = toNumber(number);
|
||||||
return number >= nativeMin(start, end) && number < nativeMax(start, end);
|
return number >= nativeMin(start, end) && number < nativeMax(start, end);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user