Noes
Noes
is a javascript library that checks if its conjunction is satisfied.
Installation
npm install noes --save
Quick usage
Or
; const or = tywin: 'lannister' day: 'light' game: 'of thrones'; or; // trueor; // trueor; // falseor; // false
And
; const and = tywin: 'lannister' day: 'light' game: 'of thrones'; and; // trueand // falseand // false
Array value
When the given mapping value is an array of predicate object, then it will be satisfied if the given input satisfies the predicate objects based on its parent's type. Example:
const and = name: $notEqual: 'hi' '!==': 'there' iron: 'man'; and // true // Will return false because name must not be equal to 'hi' and 'there'and const or = name: $equal: 'hi' '===': 'there' iron: 'man'; // Will return true because 'iron' property is satisfiedor // Will return true because name must be equal to 'hi' or 'there'or
Nested example
Noes
supports nested examples (you can nest as deep as you want)
const or = name: ye: 'saboteur' lannister: 'approves' ; // Or with an objectconst or = name: type: 'or' mappings: ye: 'saboteur' lannister: 'approves' ;
License
MIT