Created
October 20, 2016 21:53
-
-
Save max-winderbaum/3f7bf74676804a6b494d1b14f3f68f36 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
import { Map, List } from 'immutable'; | |
export default function getPhrasesByBlock(phrases) { | |
return phrases.reduce( | |
(phrasesByBlock, phrase) => phrasesByBlock.update( | |
phrase.get(`blockKey`), | |
new List(), | |
(blockPhrases) => blockPhrases.push(phrase) | |
), | |
new Map(), | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment