northwesternmutual/regent

Support boolean literals in find and filter

Closed this issue · 0 comments

Allow find and filter to evaluate boolean literals as rules. This is preferable in situations where you have access to all the data needed to evaluate a rule in one place (like the server) and don't want to have to pass that data down. You can pre-evaluate your rules and just pass down the result.

const logic = [
  { text: 'not me', rule: false },
  { text: 'me!', rule: true }
]

const result = find(logic, {})
console.log(result.text) // --> "me!"

We should also support boolean literals in all composition functions