title: Group array of objects into specific format
body: <p>I have an array of objects in this format:</p>
  
  <pre><code>const arr = [
      {
          parentKey: {
              myKey1: 'someStringA',
              myKey2: 'anotherStringA',
              myKey3: false,
              myKey4: true
          },
          anotherKey: {}
      },
      {
          parentKey: {
              myKey1: 'someStringA',
              myKey2: 'anotherStringA',
              myKey3: true,
              myKey4: false
          },
          anotherKey: {}
      },
      {
          parentKey: {
              myKey1: 'someStringA',
              myKey2: 'anotherStringA',
              myKey3: true,
              myKey4: false
          },
          anotherKey: {}
      },
      {
          parentKey: {
              myKey1: 'someStringA',
              myKey2: 'anotherStringA',
              myKey3: true,
              myKey4: true
          },
          anotherKey: {}
      },
      {
          parentKey: {
              myKey1: 'someStringA',
              myKey2: 'anotherStringB',
              myKey3: true,
              myKey4: true
          },
          anotherKey: {}
      },
      {
          parentKey: {
              myKey1: 'someStringB',
              myKey2: 'anotherStringB',
              myKey3: false,
              myKey4: true
          },
          anotherKey: {}
      }
  ];
  </code></pre>
  
  <p>And I need to get a result in this format:</p>
  
  <pre><code>const result = [
      {
          props: {
              myKey1: 'someStringA',
              myKey2: 'anotherStringA',
              myKey3: false,
              myKey4: true
          },
          entries: [
              {
                  parentKey: {
                  myKey1: 'someStringA',
                  myKey2: 'anotherStringA',
                  myKey3: false,
                  myKey4: true
                  },
                  anotherKey: {}
              }
          ] 
      },
      {
          props: {
              myKey1: 'someStringA',
              myKey2: 'anotherStringA',
              myKey3: true,
              myKey4: false
          },
          entries: [
              {
                  parentKey: {
                  myKey1: 'someStringA',
                  myKey2: 'anotherStringA',
                  myKey3: true,
                  myKey4: false
                  },
                  anotherKey: {}
              },
              {
                  parentKey: {
                      myKey1: 'someStringA',
                      myKey2: 'anotherStringA',
                      myKey3: true,
                      myKey4: false
                  },
                  anotherKey: {}
              }
          ] 
      },
      {
          props: {
              myKey1: 'someStringA',
              myKey2: 'anotherStringA',
              myKey3: true,
              myKey4: true
          },
          entries: [
              {
                  parentKey: {
                      myKey1: 'someStringA',
                      myKey2: 'anotherStringA',
                      myKey3: true,
                      myKey4: true
                  },
                  anotherKey: {}
              }
          ] 
      },
      {
          props: {
              myKey1: 'someStringA',
              myKey2: 'anotherStringB',
              myKey3: true,
              myKey4: true
          },
          entries: [
              {
                  parentKey: {
                      myKey1: 'someStringA',
                      myKey2: 'anotherStringB',
                      myKey3: true,
                      myKey4: true
                  },
                  anotherKey: {}
              }
          ] 
      },
      {
          props: {
              myKey1: 'someStringB',
              myKey2: 'anotherStringB',
              myKey3: false,
              myKey4: true
          },
          entries: [
              {
                  parentKey: {
                      myKey1: 'someStringB',
                      myKey2: 'anotherStringB',
                      myKey3: false,
                      myKey4: true
                  },
                  anotherKey: {}
              }
          ] 
      }
  ];
  </code></pre>
  
  <p>I am trying to write a function groupArray which will group array of object based on array of keys provided, e.g., <code>groupArray(arr, ['parentKey.myKey1', 'parentKey.myKey2', 'parentKey.myKey3', 'parentKey.myKey4'])</code> but haven't succeeded. Here is the <a href="https://jsfiddle.net/vk2xqrc4/1/" rel="nofollow noreferrer">jsfiddle</a> with my code. All entries are currently placed in resulting array without being grouped.</p>
  
  <p>Could you give me hint how to fix my function.   </p>