Using a full-blown Tree data structure seemed kind of an overkill for one of my projects.
It is a simple app that prompts the user binary questions (Yes / No) and provides a conclusion based on a flow chart.
The purpose is to make a complex flowcharts more accessible by translating the steps into a series of user prompts.
I was supplied a visual flow chart by my partner, I looked at BPMN for representing the logic but it seemed like an overkill for my small projects.
There were a few other JS libraries I played around with but they also seemed a little far fetched.
So I decided to make a simple workflow processor myself. A JS hash with semantic keys to denote hierarchy between elements.
A flow chart can be represented as follows
1_A - Root -> A
1_A_B - Root -> B // Terminal node
1_A_A - Root -> A -> A
1_A_B - Root -> A -> B
The processor looks for matching keys to descend down the hierarchy. Essentially, it is an oversimplified representation of something like a nested JS object.