Restructure array of objects by grouping the names with same id and sorting their place by rank

I’ve been struggling to restructure this particular object;

[
  {
    "userId": 1,
    "name": "Breaker of Sky",
    "rank": 1
  },
  {
    "userId": 1,
    "name": "Slayer of Mountain",
    "rank": 2
  },
  {
    "userId": 1,
    "name": "Balthromaw",
    "rank": 3
  },
  {
    "userId": 1,
    "name": "Death",
    "rank": -1
  },
  {
    "userId": 3,
    "name": "Breaker of Sky",
    "rank": 2
  },
  {
    "userId": 3,
    "name": "Slayer of Mountain",
    "rank": 3
  },
  {
    "userId": 3,
    "name": "Balthromaw",
    "rank": 1
  },
  {
    "userId": 3,
    "name": "Death",
    "rank": -1
  },
  {
    "userId": 4,
    "name": "Breaker of Sky",
    "rank": 3
  },
  {
    "userId": 4,
    "name": "Slayer of Mountain",
    "rank": 2
  },
  {
    "userId": 4,
    "name": "Balthromaw",
    "rank": 1
  },
  {
    "userId": 4,
    "name": "Death",
    "rank": -1
  },
  {
    "userId": 8,
    "name": "Breaker of Sky",
    "rank": 2
  },
  {
    "userId": 8,
    "name": "Slayer of Mountain",
    "rank": 3
  },
  {
    "userId": 8,
    "name": "Balthromaw",
    "rank": 4
  },
  {
    "userId": 8,
    "name": "Death",
    "rank": 1
  }
]

to make it look like this object below.

[
     { ranking: [['Death'], ['Breaker of Sky'], ['Slayer of Mountain'], ['Balthromaw']], count: 2 },
     { ranking: [['Death'], ['Balthromaw'], ['Breaker of Sky'], ['Slayer of Mountain']], count: 1 },
     { ranking: [['Death'], ['Balthromaw'], ['Slayer of Mountain'], ['Breaker of Sky']], count: 1 },
]

To simply explain the process, we first need to look for the userId’s and group the names with ranks which have same userId’s. Then it should line up the names by looking their ranks (-1 will always be at the first place). After that, we should look for the sequence, count it and write down. As an example, this sequence, [['Death'], ['Breaker of Sky'], ['Slayer of Mountain'], ['Balthromaw']] , has been found 2 times and therefore count is 2.

I would appreciate your help regarding this problem and I wish you a happy and healthy New Year.