title: Using lodash to map complex JSONs
body: <p>I'm trying to map data from one format to another and I'm having some hard time. </p>
  
  <p><strong>FIRST ONE</strong></p>
  
  <p>from:</p>
  
  <pre><code>  types: {
        one: [0.0954835843,6.054385,84.40238],
        two: [0.0954835843,6.054385,84.40238],
        three: [0.0954835843,6.054385,84.40238]
      },
  </code></pre>
  
  <p>to</p>
  
  <pre><code>    types: [
        [0.0954835843,6.054385,84.40238 , 'one'],
        [0.0954835843,6.054385,84.40238, 'two'],
        [0.0954835843,6.054385,84.40238, 'three']
      ],
  </code></pre>
  
  <p><strong>SECOND ONE</strong>
  match with ID, by getting data from two objects</p>
  
  <pre><code>          types:[{
              id:1, 
              data:[
                      [
                          'temp',
                          '46%',
                          '14.00',
                          '1388.68561604',
                          '1388.68561604',
                          '2018-02-12 18:21'
  
                      ],
                      [
                          'nottemp',
                          '46%',
                          '14.00',
                          '1388.68561604',
                          '1388.68561604',
                          '2018-02-12 18:21'
  
                      ],
                 ] 
              },
              {
              id:2, 
              data:[
                      [
                          'temp',
                          '46%',
                          '14.00',
                          '1388.68561604',
                          '1388.68561604',
                          '2018-02-12 18:21'
  
                      ],
                      [
                          'nottemp',
                          '46%',
                          '14.00',
                          '1388.68561604',
                          '1388.68561604',
                          '2018-02-12 18:21'
  
                      ],
                 ] 
              }]
  
  
  
  
  
  
  data: [
          {
            id: 1,
            name: 'sibling',
          },
          {
            id: 2,
            name: 'parent',
          },
       ]
  </code></pre>
  
  <p>and end up with all the items from types.data in format like:</p>
  
  <pre><code>        [
                  'temp',
                  '46%',
                  '14.00',
                  '1388.68561604',
                  '1388.68561604',
                  '2018-02-12 18:21'
                  'parent' //or sibling, depends on id
  
              ]
  </code></pre>
  
  <p>I actually have no idea how I can achive that with some mapping or filtering.
  It's crazy hard for me to achive it without tons of modifiers and without creating few additional arrays in the process. Is there any way to optimize it?</p>
  
  <p><strong>EDIT</strong>
  for the second issue I have:</p>
  
  <pre><code>   mapElement: function(){
          let that=this;
          return _.map(this.getTypesData,function(element){
            let data=[];
            let pairName = that.getFamily(element.id); //todo: matching id of Type with id of object with names
            element.data.forEach(function(element){
              data.push([
                pairName,
                element[0],
                element[1],
                element[2],
              ]);
            });
            return data;
          });
        }
  </code></pre>