Last active
May 30, 2018 20:28
-
-
Save WaldoJeffers/42960418c850403b576e07585cbc79f8 to your computer and use it in GitHub Desktop.
Filter an object using an asynchronous predicate with conductor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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