123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657openCore_utilsopenBrowser_js_typesletreturn_none():'aoption=Noneletreturn_some(x:'a):'aoption=Somex(** [opt_case] checks if the [Js.t] is [null] then returns [None] if it is. If it's not,
it will run [some] on the value and then return it as a [Some] *)letopt_case(opt:'aJs.opt)~(some:'a->'b):'boption=Js.Opt.caseoptreturn_none(some>>return_some);;(** [opt_map] maps ['a option] to ['a Js.opt] and then applies [f] to map ['a Js.opt] to
['b Js.opt] *)letopt_map(x:'aoption)~(f:'a->'b):'bJs.opt=letopt=Js.Opt.optionxinJs.Opt.mapoptf;;(** [optdef_case] checks if the [Js.t] is [undefined] then returns [None] if it is. If
it's not, it will run [some] on the value and then return it as a [Some] *)letoptdef_case(optdef:'aJs.optdef)~(some:'a->'b):'boption=Js.Optdef.caseoptdefreturn_none(some>>return_some);;(** [optdef_map] maps ['a option] to ['a Js.optdef] and then applies [f] to map
['a Js.optdef] to ['b Js.optdef] *)letoptdef_map(x:'aoption)~(f:'a->'b):'bJs.optdef=letoptdef=Js.Optdef.optionxinJs.Optdef.mapoptdeff;;(** [opt_optdef_case] checks if the ['a Js.opt Js.optdef Js.t] is [undefined] or [null]
then returns [None] if it is. If it's not, it will run [some] on the ['a] and then
return it as a [Some 'a] *)letopt_optdef_case(opt_optdef:'aJs.optJs.optdef)~(some:'a->'b):'boption=Js.Optdef.caseopt_optdefreturn_none(opt_case~some);;(** [opt_optdef_to_option] checks if the ['a Js.opt Js.optdef Js.t] is [undefined] or
[null] then returns [None] if it is. If it's not, it returns the ['a] as a [Some 'a] *)letopt_optdef_to_option(opt_optdef:'aJs.optJs.optdef):'aoption=Js.Optdef.caseopt_optdefreturn_noneJs.Opt.to_option;;(** [opt_optdef_map] maps ['a option] to ['a Js.optdef] and then applies [f] and
[Js.Opt.return] to map ['a Js.optdef] to ['b Js.opt Js.optdef] *)letopt_optdef_map(x:'aoption)~(f:'a->'b):'bJs.optJs.optdef=letf=f>>Js.Opt.returninoptdef_map~fx;;(** [opt_optdef_map] maps ['a option] to ['a Js.optdef] and then applies [Js.Opt.return]
to map ['a Js.optdef] to ['a Js.opt Js.optdef] *)letopt_optdef_of_option(x:'aoption):'aJs.optJs.optdef=Js.Opt.optionx|>Js.Optdef.return;;