title: How to create groups with address string from list of users with groups?
body: <p>I need to get a list of unique groups from a list of users, where each user has membership of one or more groups at different levels. The levels form a hierarchy that I want to be saved on the group as an address (kind of like an IP address). A user must belong to all groups in the hierarchy, so for example it's not possible to be member of a Level 3 group without also being member of all groups above. I get the list of users from an API that I'm not in control of, so unfortunately the incoming structure cannot be changed.</p>
  
  <p>Given the following example list of users:</p>
  
  <pre><code>const users = [
    {
      'Level 1': 'first',
      'Level 2': 'second',
      'Level 3': 'third'
    },
    {
      'Level 1': 'first',
      'Level 2': 'second',
      'Level 3': 'another'
    }
  ]
  </code></pre>
  
  <p>When calling a function like: <code>const groups = getGroups(users})</code> it should return: </p>
  
  <pre><code>const expectedGroups = [
    {
      name: 'first',
      address: '1'
    },
    {
      name: 'second',
      address: '1.1'
    },
    {
      name: 'third',
      address: '1.1.1'
    },
    {
      name: 'another',
      address: '1.1.2'
    }
  ]
  </code></pre>