Skip to contents

Unwrap a maybe value or return a default

Usage

with_default(.m, default)

from_maybe(.m, default)

Arguments

.m

A maybe value

default

A default value to return if the maybe value is 'Nothing'

Value

The unwrapped maybe value or the default value

Examples

just(1) %>% with_default(default = 0)
#> [1] 1
nothing() %>% with_default(default = 0)
#> [1] 0