Created
October 19, 2020 21:27
-
-
Save MeetMartin/afbb151e99c98b17a51e40577c12dded to your computer and use it in GitHub Desktop.
This file contains hidden or 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 {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