title: Transform object data with recursive
body: <p><strong>I try to transform data with recursive but I can't, I'm very newbie for recursive please help me</strong></p>
  
  <p>Is it need to do with recursive or not what you guy think,
  Please help me</p>
  
  <p><em>(sorry for my english)</em></p>
  
  <p><strong>This is my data</strong></p>
  
  <pre class="lang-js prettyprint-override"><code>const mock = [
    { $: { id: '001' } },
    {
      $: { id: '002' },
      question: [{
        $: { id: 'r001' },
        prompt: 'some-r001',
        choices: [{
          question: [
            {
              $: { id: 'r001-1' },
              prompt: 'some-r001-1',
              choices: [{
                question: [{
                  $: { id: 'r001-1-1' },
                  prompt: 'some-r001-1-1',
                  choices: [""],
                }]
              }]
            },
            {
              $: { id: 'r001-2' },
              prompt: 'some-r001-2',
              choices: [""],
            },
          ]
        }]
      }]
    }
  ]
  </code></pre>
  
  <p><strong>I want to transform to this</strong></p>
  
  <pre class="lang-js prettyprint-override"><code>const result = {
     'r001': {
       prompt: 'some-r001',
       next: ['r001-1', 'r001-2'],
     },
     'r001-1': {
       prompt: 'some-r001-1',
       next: ['r001-1-1'],
     }
     'r001-1-1': {
       prompt: 'some-r001-1-1',
       next: [],
     },
     'r001-2': {
       prompt: 'some-r001-2',
       next: [],
     },
  }
  </code></pre>