Created
May 22, 2018 21:11
-
-
Save WaldoJeffers/bcbe85cdfc2babc5724c0f0be6a5fcba to your computer and use it in GitHub Desktop.
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 { compose, equals, filter, get } from 'conductor' | |
const character_ids = [1, 2, 3, 4, 5] | |
const fetchCharacter = id => fetch(`https://swapi.co/api/people/${id}`).then(res => res.json()) | |
const hasBlueEyes = compose(equals('blue'), get('eye_color'), fetchCharacter)) | |
await filter(hasBlueEyes, characters_ids) // [{ name: 'Luke Skywalker }, { name: 'Owen Lars' }, ...] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment