Write .inRange()

This commit is contained in:
marleyrae 2023-06-27 18:17:29 -07:00
parent 534819ee57
commit 10d7c5a686

View file

@ -4,5 +4,22 @@ let _ = {}
_.clamp = (num, lower, higher) => Math.min(Math.max(num, lower), higher)
/* ------------------------------------------------------------- inRange ---- */
_.inRange = function (num, start, end) {
if (!end) {
end = start
start = 0
}
if (start > end) {
let s = start
start = end
end = s
}
return start <= num && num < end
}
// Do not write or modify code below this line.
module.exports = _