mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-01 23:57: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
|
||||
*/
|
||||
function inRange(number, start, end) {
|
||||
start = +start || 0;
|
||||
start = toNumber(start) || 0;
|
||||
if (end === undefined) {
|
||||
end = start;
|
||||
start = 0;
|
||||
} else {
|
||||
end = +end || 0;
|
||||
end = toNumber(end) || 0;
|
||||
}
|
||||
number = toNumber(number);
|
||||
return number >= nativeMin(start, end) && number < nativeMax(start, end);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user