Skip to content

Instantly share code, notes, and snippets.

@kylecorbelli
Last active May 1, 2018 14:33
Show Gist options
  • Save kylecorbelli/be7967767c19c8af052d7b97797c7b32 to your computer and use it in GitHub Desktop.
Save kylecorbelli/be7967767c19c8af052d7b97797c7b32 to your computer and use it in GitHub Desktop.
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