I am looking for a way in Typescript to group data from table rows into all possible groups of N size?
For example:- Lets say I wanted to create groups of 3 (but this value can change) based on District (so all A's can be together, all B's etc), however I want to keep ALL the data.
So for A the groups would be as below yet keep ALL their meta data. I am in looping hell and I'm thinking there must be something I'm missing!
| A Group |
|---|
| John, Suzie, Areli |
| John, Suzie, Waylon |
| John, Suzie, Bentley |
| John, Areli, Waylon |
| John, Areli, Bentley |
| Suzie, Areli, Waylon |
| Suzie, Areli, Bentley |
| Areli, Waylon, Bentley |
Consider I have the following data:-
| Name | District | Favourite Color | Age Group |
|---|---|---|---|
| John | A | Red | 1 |
| Suzie | A | Green | 2 |
| Tom | B | Blue | 1 |
| Phillip | C | Blue | 1 |
| Tristen | C | Blue | 2 |
| Areli | A | Green | 2 |
| Cecilia | B | Blue | 2 |
| Elyse | D | Blue | 2 |
| Waylon | A | Green | 2 |
| Issac | B | Blue | 1 |
| Uriah | C | Green | 2 |
| Bentley | A | Green | 2 |
| Darian | B | Red | 1 |
| Haley | C | Red | 2 |
| Shaniya | D | Red | 1 |
| James | D | Green | 1 |