logical-operators
A tiny library that abstracts away logical operators with the intention of improving code readability. Ideal for composing complex validation queries.
Install
$ npm install logical-operators --save
Usage
every ( && )...
const every = const is = const values = 1 9 7'level' 'Venezuela' 'Caracas' 'Aba' 'hola' 10 undefined 'USA' const palindromeCities = values // => ['Aba'] values // => false values // => true
some ( || ) ...
const some = const between = const is = const values = 'a''b''two' 'd' 'x' 3 undefined null'three' values // => false values // => ['b', 3, 'x']
or ( || )
Same as 'some' but only accepts 2 params
const or = const is = const values = 12'three' const string_or_number = values // => true values // => [1, 2, 'three']
both ( && )
Same as 'every' but only accepts 2 params
const both = const is = const values = 'a''b''two' const string_and_singleChar = values // => false values // => ['a','b']
equal ( == )
const equal greater = const is = const compose = var str var values = 123 'ab' 'e' 'T' 'W' '/' values // => false values // => ['ab', 'e']
License
MIT © Alvaro Bernal