baseInRange
"Dude, suckin' at something is the first step to being sorta good at something." —Jake, "Adventure Time"
本文为 《lodash 源码阅读》 系列文章,后续内容会在 github 中发布,欢迎 star,gitbook 同步更新。
源码
原理
baseInRange
的写法有两个优点:
支持负范围,当
start
小于end
时,baseInRange
依旧可以正确判断 number 是否在负区间内兼容
NaN
情况,若参数有一个值为NaN
,方法将返回false
相关链接
Last updated
Was this helpful?