Created
April 7, 2023 16:30
-
-
Save KristofferTolboll2/84aaedb6e91a63aa1c4efbbf2b2b23fc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function mergeSeedResults(...seedResults: Array<Partial<SeedResult>>): SeedResult { | |
| const mergedSeedResult = new SeedResult(); | |
| Object.keys(mergedSeedResult).forEach((key) => { | |
| if (Array.isArray(mergedSeedResult[key])) { | |
| const mergedArray: any[] = []; | |
| seedResults.forEach((seedResult) => { | |
| if (seedResult && Array.isArray(seedResult[key])) { | |
| mergedArray.push(...seedResult[key]); | |
| } | |
| }); | |
| mergedSeedResult[key] = mergedArray; | |
| } | |
| }); | |
| return mergedSeedResult; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment