长度区间校验公共方法,引入棉花糖
const notShorter = (o, minLen) => {
if (o.length < minLen) {
return false
}
return true
}
const notLonger = (o, maxLen) => {
if (o.length > maxLen) {
return false
}
return true
}
const isInClosedInterval = (o, minLen, maxLen) => {
return notShorter(o, minLen) && notLonger(o, maxLen)
}