Last active
January 28, 2021 21:33
-
-
Save davidseek/03d9c8d3fefeb111fce30802aa124b4f to your computer and use it in GitHub Desktop.
Push Notifications Lodash
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
| // Import statement to use lodash | |
| const _ = require('lodash') | |
| /** | |
| * Converts the array to an array per userID | |
| * @param tasks Tasks to convert | |
| * @returns a dictionary of [userID: [Task]] | |
| */ | |
| function getFormatted(tasks: Task[]): { [userID: string]: Task[]; } { | |
| // Use lodash function groupBy. | |
| // Pass it the Array, and the key. | |
| return _.groupBy(tasks, 'userID') | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment