Skip to content

Instantly share code, notes, and snippets.

@allanhortle
Last active March 31, 2016 23:29
Show Gist options
  • Save allanhortle/e8a8f45189d8776a2e5b to your computer and use it in GitHub Desktop.
Save allanhortle/e8a8f45189d8776a2e5b to your computer and use it in GitHub Desktop.
Immutable JS Lodash Equivalants

Immutable Lodash Equivilants

Unique list from the value of a key in a collection.

// Lodash
_(data).uniq(dd => dd.value).value()

// Immutable
List(data).reduce((rr, dd) => rr.set(dd.value, dd), Map()).toArray()

Intersection

// Lodash
_.intersection(aa,bb)

// Immutable
Set(aa).intersection(bb)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment