Skip to content

Instantly share code, notes, and snippets.

@bjruberg
Last active October 1, 2018 19:36
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 bjruberg/23283f9339aa935b3416305279843979 to your computer and use it in GitHub Desktop.
Save bjruberg/23283f9339aa935b3416305279843979 to your computer and use it in GitHub Desktop.
import { chain, filter, map, sortBy, uniqBy, compact } from "lodash";
const messageList = [{ user: 1, messageId: 1, creationDate: new Date(), text: "Hello" }];
chain(messageList)
.filter({ user: 1 })
.sortBy("creationDate")
.uniqBy("messageId")
.map("text")
.compact()
.valueOf();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment