Skip to content

Instantly share code, notes, and snippets.

@cezarneaga
Created February 13, 2019 22:28
Show Gist options
  • Save cezarneaga/8b5fddd0eb2386e066490b13e031dd57 to your computer and use it in GitHub Desktop.
Save cezarneaga/8b5fddd0eb2386e066490b13e031dd57 to your computer and use it in GitHub Desktop.
filter array by array
const array = [1, 2, 4]
const collection = [{ type: 1, eyes: 'blue'},{ type: 2, eyes: 'brown'}, { type: 3, eyes: 'green'}, { type: 4, eyes: 'blue'}]

const joinByType = R.innerJoin(
  (o, type) => o.type === type
)

const result = joinByType(collection, array)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment