Skip to content

Instantly share code, notes, and snippets.

@max-winderbaum
Created October 20, 2016 21:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save max-winderbaum/3f7bf74676804a6b494d1b14f3f68f36 to your computer and use it in GitHub Desktop.
Save max-winderbaum/3f7bf74676804a6b494d1b14f3f68f36 to your computer and use it in GitHub Desktop.
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