Created
June 16, 2018 14:33
-
-
Save dance2die/6ef5401930840c141464a2e2965af038 to your computer and use it in GitHub Desktop.
This file contains 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
// Build item details map | |
// for an O(1) look up for fetched item details | |
const items = (await getStories(storyIds)) | |
.map(res => res.data) | |
.filter(item => item !== null) | |
.reduce((acc, item) => acc.set(item.id, item), new Map()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment