Last active
June 6, 2017 23:56
-
-
Save choonkending/57a8ce44d4a317cf576d6eb76113feb6 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
const transformCage = () => { /* ... */ }; | |
const handleError = e => "failed to parse Cage"; | |
const handleSuccess = data => "Success"; | |
const ifEmpty = () => "Cage does not exist!"; | |
const doSomethingWithUserData = () => | |
getUserFromLocalStorage('nickCage') | |
.fold(handleError, | |
data => | |
data.map(transformCage) | |
.fold( | |
ifEmpty, | |
handleSuccess | |
) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment