长度区间校验公共方法,引入棉花糖

 

 

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)
}

 

posted @ 2018-09-10 23:44  papering  阅读(216)  评论(0编辑  收藏  举报