boolean-json-prune
This package cleans up boolean-json expressions.
Usage
const prune = ; const input = and: or: and: and: 'foo' 'bar' and: 'foo2' 'bar2' or: 'foo3' 'bar4' 'foo4'; const output = ;/*{ and: [{ or: [{ and: ['foo', 'bar', 'foo2', 'bar2'] }, 'foo3', 'bar4'] }, 'foo4']}*/
Operations
Note: any combination of these operations is also possible.
Combining nested conjunctions/disjunctions
Input:
Output:
Removing duplicates
Input:
Output:
Removing redundant nested conjunctions/disjunctions
Input:
Output:
"foo"
Input:
Output:
"foo"