nv-facutil-notandor
v1.0.5
Published
simple and,or,not to void too many || and &&
Downloads
43
Readme
nv-facutil-notandor
- nv-facutil-notandor is a very simple tool to avoid use too many || && !
- make your code readable
install
- npm install nv-facutil-notandor
usage
const {and,or,at_least_some} = require("nv-facutil-notandor")
function wrap(x,y,z,u) {
let rslt = and(
x+y >0,
and(
x%z>-300,
or(y>8,u<100),
at_least_some(2,y%7!==3,y%7!==5,y%7!==1)
),
or(x*y < 9800,x>-100)
)
return(rslt)
}
> wrap(-100,999,7,50)
true
>
APIS
not
not(100) === false
not(false) === true
and,all
# all are true
and(true,false,true) === false
all(true,false,true) === false
all_not
# all are false
all_not(true,false,false) === false
all_not(false,false,false) === true
or,any
# any is true
or(false,true,false) === true
any(false,true,false) === true
any(false,false,false) === false
any_not
# any is false
any_not(false,true,true) === true
any_not(true,true,true) === false
at_least_some
# at least n are true
at_least_some(2,false,true,true,true,false) === true
at_least_some(2,false,true,false,false,false) === false
at_least_some_not
# at least n are false
at_least_some_not(2,false,true,false,true,false) === true
at_least_some_not(2,true,true,false,true,true) === false
must_some
# only n are true,others are false
must_some(2,false,true,false,true,false) === true
must_some(2,false,true,true,true,false) === false
must_some_not
# only n are false,others are true
must_some_not(2,false,true,false,true,false) === false
must_some_not(2,true,false,false,true,true) === true
one
# only 1 are true,others are false
one(true,true,false) === false
one(false,true,false) === true
one_not
# only 1 are false,others are true
one_not(true,true,false) === true
one_not(false,true,false) === false
at_least_certain
# at least the-inputed-indexes are true
at_least_certain([1,3],false,true,false,true,false,false) === true
at_least_certain([1,3],false,false,false,true,false,false) === false
at_least_certain_not
# at least the-inputed-indexes are false
at_least_certain_not([1,3],false,true,false,true,false,false) === false
at_least_certain_not([1,3],false,false,true,false,true,true) === true
must_certain
# only the-inputed-indexes are true,others are false
must_certain([1,3],true,true,false,true,false,false) === false
must_certain([1,3],false,true,false,true,false,false) === true
must_certain_not
# only the-inputed-indexes are false,others are true
must_certain_not([1,3],true,false,false,false,true,true) === false
must_certain_not([1,3],true,false,true,false,true,true) === true
at_most_some:
(max_count,...params)=>Boolean
at_most_some_not:
(max_count,...params)=>Boolean
some_between
(ge,lt,...params) => Boolean
some_not_between
(ge,lt,...params) => Boolean
at_most_certain:
#only the-inputed-indexes maybe-true,others are false
(whiches,...params)=>Boolean,
at_most_certain_not:
#only the-inputed-indexes maybe-false,others are true
(whiches,...params)=>Boolean,
LICENSE
- ISC