Skip to content

Instantly share code, notes, and snippets.

@WaldoJeffers
Last active May 30, 2018 20:28
Show Gist options
  • Save WaldoJeffers/42960418c850403b576e07585cbc79f8 to your computer and use it in GitHub Desktop.
Save WaldoJeffers/42960418c850403b576e07585cbc79f8 to your computer and use it in GitHub Desktop.
Filter an object using an asynchronous predicate with conductor
import { filter } from 'conductor'
const obj = { books: 10, ruler: 1, pencils: 5 }
const isEven = x => Promise.resolve(x % 2 === 0)
const result = await filter(isEven, obj) // { books: 10 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment