Skip to content

Instantly share code, notes, and snippets.

/** Dependencies
* @glennsl/bs-json: Encoding Data
* bs-decode: Decoding Data
**/
open Belt.Result;
[@bs.val] [@bs.scope "localStorage"]
external removeItem: string => unit = "removeItem";
[@bs.module] external startCase: string => string = "lodash.startcase";
[@bs.module] external unique: array('a) => array('a) = "lodash.uniq";
[@bs.module]
external sortby: (array('a), array('a => 'b)) => array('a) =
"lodash.sortby";
[@bs.module]
external difference: (array('a), array('a)) => array('a) =
"lodash.difference";
[@bs.module] external isEqual: ('a, 'a) => bool = "lodash.isequal";
type tz = {. [@bs.meth] "names": unit => array(string)};
type moment = {
.
[@bs.meth] "tz": string => moment,
[@bs.meth] "format": string => string,
[@bs.meth] "fromNow": unit => string,
};
[@bs.module "moment-timezone"] external tz: tz = "tz";
[@bs.module "@sentry/browser"]
external captureParserException:
Decode.AsResult.OfParseError.ParseError.failure => unit =
"captureException";
[@bs.module "@sentry/browser"]
external capturePromiseException: Js.Promise.error => unit =
"captureException";
[@bs.module "@sentry/browser"]
type location = {
.
"href": string,
"hash": string,
"search": string,
};
[@bs.val] [@bs.scope "window"] external location: location = "location";
[@bs.module "email-validator"] external email: string => bool = "validate";
[@bs.module "url-validator"] external url: string => bool = "default";
type state = {
.
"name": string,
"appreviation": string,
"territory": bool,
"capital": string,
"contiguous": bool,
};
type t = {. "states": array(state)};
type parsed = {
data: Js.Json.t,
errors: array(string),
};
external jsonToJsOb: Js.Json.t => Js.t('a) = "%identity";
type error = {
type_: string,
code: string,
type itemRenderer('a) =
{
.
"data": 'a,
"index": int,
"style": ReactDOMRe.Style.t,
} =>
React.element;
module FixedSizeList = {
[@bs.module "react-outside-click-handler"] [@react.component]
external make:
(
~onOutsideClick: unit => unit,
~children: React.element,
~disabled: bool=?,
~useCapture: bool=?,
~display: [@bs.string] [
| `block
| `flex