Created
October 10, 2019 06:20
-
-
Save adamdickinson/18b7ca6c6e0bb63f81476d9ddcb0bed0 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
const notifications [ | |
{ id: 1 } | |
]; // store.get("notifications") | |
const watchers = [ | |
{ notificationId: 1, userId: 1 } | |
{ notificationId: 1, userId: 2 } | |
{ notificationId: 2, userId: 2 } | |
]; // store.get("watchers") | |
notifications() { | |
const notifications = store.get("notifications"); | |
notifications | |
.map(notification => { | |
...notification, | |
watching: watchers.some(({ notificationId, userId }) => notification.id === notificationId && userId === 1); | |
}); | |
return notifications; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment