Javascript: Validate dynamic conditions in a object node

Consider the tree nodes from the image above.

We would like to navigate through the tree and return some data if the node’s conditions is met.

This may be easy when we have static conditions for all nodes(objA == objB for example). But what about dynamic conditions? how can we handle different condition types for each node?.

We may have the following conditions:

NodeA: Object.property > 50
NodeB: Object.property2 === ‘Agree’
NodeC: Object !== undefined
NodeD: Object.property === ‘A’ or Object.property === ‘B’

For this purpose we will use the library ‘json-rules-engine’…

Gabriel Bravo

Full-Stack Software Developer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store