How to make a tree structure (multi-level list) from an Object(s)
<p>The list is result of an object being parsed. The problem is, I need to make it as a tree structured list. Eg: The <li> FGN161B, should be a tree structure for the following two li's after it. And the <li> SSIB0BB, should also be a tree structure to the <li> with same name, following after it.</p>

<p>unordered list's ID = "unorderedList"
<strong><li>FGN161B</li></strong>
<em><li>FGN161B at SHAJCT, WY</li>
<li>FGN161B at WENDOVER, WY</li></em>
<strong><li>CCSD</li>
<li>TFGOAL</li>
<li>BLOG</li>
<li>SSIBOBB</li></strong>
<em><li>SSIBOBB at HARPOWPLA, TX</li></em>
<strong><li>TRNPROF</li></strong></p>

<p>HINT: The first 7 characters of the parent-li (eg. FGN161B), will always match the 7 characters of its sub-li(e.g FGN161B at SHAJCT) ---- Makes sense????</p>

<p><strong>Here's the code that creates the list from a JSON:</strong></p>

<p>var $commands = $sideBar.find('#unorderedList');</p>

<pre><code>    // Xpress commands
    flow.oneway(
        flow.dom.children($commands),
        [services.xpress.commands.content],
        function (commands) {
            if (!ds.isEmpty(commands)) {
                var enumed   = services.xpress.enumerate(commands[0].details),
                    filtered = fp.filter(enumed,
                                    function (command) {
                                        return !(command.commandName.startsWith("BLOG at") || command.commandName.startsWith("ALOG at"));
                                    }),
                    actions  = fp.map(filtered,
                                    function (command) {
                                        var href        = command.url,
                                            commandName = command.commandName;
                                        return {
                                            label  : commandName,
                                            href   : href,
                                            target : "_blank"
                                        };
                                    });

                if (!ds.isEmpty(actions)) {
                    return ich.actions({ actions : actions });
                }

                return ich.action({ label : 'No Xpress commands available' });
            }
            return ich.action({ label : 'No train selected' });
        }
    );
</code></pre>
