import { some, none, match } from 'fp-ts/Option'
import { pipe } from 'fp-ts/function'
assert.strictEqual(
pipe(
some(1),
match(() => 'a none', a => `a some containing ${a}`)
),
'a some containing 1'
)
assert.strictEqual(
pipe(
none,
match(() => 'a none', a => `a some containing ${a}`)
),
'a none'
)
2.10.0
Takes a (lazy) default value, a function, and an
Option
value, if theOption
value isNone
the default value is returned, otherwise the function is applied to the value inside theSome
and the result is returned.