Simplify inRange
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
const inRange = (n, start, end = null) => {
|
||||
if (end && start > end) end = [start, (start = end)][0];
|
||||
if (end && start > end) [end, start] = [start, end];
|
||||
return end == null ? n >= 0 && n < start : n >= start && n < end;
|
||||
};
|
||||
module.exports = inRange;
|
||||
|
||||
Reference in New Issue
Block a user