package js_of_ocaml

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Js.OptSource

Standard functions for manipulating possibly null values.

Sourcetype 'a t = 'a opt
Sourceval empty : 'a t

No value.

Sourceval return : 'a -> 'a t

Consider a value as an optional value.

Sourceval map : 'a t -> ('a -> 'b) -> 'b t

Apply a function to an optional value if it is available. Returns the result of the application.

Sourceval bind : 'a t -> ('a -> 'b t) -> 'b t

Apply a function returning an optional value to an optional value

Sourceval test : 'a t -> bool

Returns true if a value is available, false otherwise.

Sourceval iter : 'a t -> ('a -> unit) -> unit

Apply a function to an optional value if it is available.

Sourceval case : 'a t -> (unit -> 'b) -> ('a -> 'b) -> 'b

Pattern matching on optional values.

Sourceval get : 'a t -> (unit -> 'a) -> 'a

Get the value. If no value available, an alternative function is called to get a default value.

Sourceval option : 'a option -> 'a t

Convert option type.

Sourceval to_option : 'a t -> 'a option

Convert to option type.

Sourceval equals : _ t -> _ t -> bool

Javascript == equality operator.

Sourceval strict_equals : _ t -> _ t -> bool

Javascript === equality operator.

OCaml

Innovation. Community. Security.