API / Js / Option

Option

Provide utilities for option

t

RESCRIPT
type t<'a> = option<'a>

some

RESCRIPT
let some: 'a => option<'a>

isSome

RESCRIPT
let isSome: option<'a> => bool

isSomeValue

RESCRIPT
let isSomeValue: (('a, 'a) => bool, 'a, option<'a>) => bool

isNone

RESCRIPT
let isNone: option<'a> => bool

getExn

RESCRIPT
let getExn: option<'a> => 'a

equal

RESCRIPT
let equal: (('a, 'b) => bool, option<'a>, option<'b>) => bool

andThen

RESCRIPT
let andThen: ('a => option<'b>, option<'a>) => option<'b>

map

RESCRIPT
let map: ('a => 'b, option<'a>) => option<'b>

getWithDefault

RESCRIPT
let getWithDefault: ('a, option<'a>) => 'a

default

Deprecated

Use getWithDefault instead since default has special meaning in ES module

RESCRIPT
let default: ('a, option<'a>) => 'a

filter

RESCRIPT
let filter: ('a => bool, option<'a>) => option<'a>

firstSome

RESCRIPT
let firstSome: (option<'a>, option<'a>) => option<'a>