Skip to content

Instantly share code, notes, and snippets.

@dewey92
Last active July 3, 2017 23:57
Show Gist options
  • Select an option

  • Save dewey92/5318f46f8d4e1e02646bb0e991ee3c57 to your computer and use it in GitHub Desktop.

Select an option

Save dewey92/5318f46f8d4e1e02646bb0e991ee3c57 to your computer and use it in GitHub Desktop.
// getChild :: Person → Maybe Person
const getChild = p => Maybe.of(p.child)
// getAge :: Person → Maybe Number
const getAge = p => Maybe.of(p.age)
// safeDivisionBy :: Number → Number → Maybe Number
const safeDivisionBy = bawah => atas =>
(bawah === 0) ? Nothing() : Maybe.of(atas / bawah)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment