title: How to convert an array of URLs into a tree/folder structure data?
body: <p>For start I have an array of URLs which I have crawled using a <a href="https://www.npmjs.com/package/simplecrawler" rel="nofollow noreferrer">simple-crawler</a> library.</p>
  <p>The data received is what I want to transform into a tree structure or folder structure.
  I am using <a href="https://www.npmjs.com/package/react-tabulator" rel="nofollow noreferrer">react-tabulator</a> here because I wanted to resize columns of table.
  Now along with normal table, I want to have the nested folder view structure.</p>
  <pre><code>//input data
  const urls = [
     { id: 1, address: 'https://happy.com' },
     { id: 2, address: 'https://happy.com/about' },
     { id: 3, address: 'https://happy.com/contact' },
     { id: 4, address: 'https://happy.com/contact/office' },
     { id: 5, address: 'https://happy.com/contact/home' },
     { id: 6, address: 'https://happy.com/projects' },
  ];
  
  //output data
  tableDataNested = [
    { id: 1, address: 'https://happy.com', 
      _children:[
        { id: 2, address: 'https://happy.com/about', _children:[] },
        { id: 3, address: 'https://happy.com/contact',
          _children:[
            { id: 4, address: 'https://happy.com/contact/office', _children:[] },
            { id: 5, address: 'https://happy.com/contact/home', _children:[] },
          ] 
        },
        { id: 6, address: 'https://happy.com/projects', _children:[] },
      ] 
    } 
  ];
  </code></pre>
  <p>Though I saw 1-2 posts resembling this concept, I wasn’t sure on the pure JS way of doing or probably use some nice libraries too.
  Any insights anyone?</p>