Skip to content

Instantly share code, notes, and snippets.

@MeetMartin
Created October 19, 2020 21:27
Show Gist options
  • Select an option

  • Save MeetMartin/afbb151e99c98b17a51e40577c12dded to your computer and use it in GitHub Desktop.

Select an option

Save MeetMartin/afbb151e99c98b17a51e40577c12dded to your computer and use it in GitHub Desktop.
import {filterMap, includes, upperCaseOf, replace, map} from '@7urtle/lambda';
const itsATortoise = replace('TORTOISE')('TURTLE');
const composedMapper = compose(itsATortoise, upperCaseOf);
// the same as const mapper = a => itsATortoise(upperCaseOf(a));
const animals = ['Russian Turtle', 'Greek Turtle', 'House Cat'];
const onlyTurtles = includes('Turtle');
filterMap(onlyTurtles)(composedMapper)(animals);
// => ['RUSSIAN TORTOISE', 'GREEK TORTOISE']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment