Last active
May 1, 2018 14:33
-
-
Save kylecorbelli/be7967767c19c8af052d7b97797c7b32 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
type UpperCaseHead = (list: ReadonlyArray<string>) => Maybe<string> | |
const upperCaseHead: UpperCaseHead = compose( | |
Maybe.map(toUpper), | |
safeHead, | |
) as UpperCaseHead | |
console.log(upperCaseHead([])) // { type: Maybe.Nothing } ie. Nothing | |
console.log(upperCaseHead([ 'rick', 'morty' ])) // { type: Maybe.Just, value: 'RICK' } ie. Just 'RICK' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment