Fantasyland maybe implementation
A fantasyland compliant implementation of the maybe monad.
var maybe = require'../'var log = console.logbindconsole '=>'var something = maybeof'Hello 'map return v + 'world!'logsomethingisSomething// => truelogsomethingvalue// => 'Hello world!'var nothing = maybenothing'Hello 'map return v + 'world!'lognothingisSomething// => falselognothingvalue// => null (never use this, it not a value!)
Unlike many other "maybe" implementations this is not a currying function that checks for null inputs, but a value representation that can be Nothing.