Skip to content

Instantly share code, notes, and snippets.

@painedpineapple
Created March 3, 2020 19:19
Show Gist options
  • Save painedpineapple/6175dfa0016330231967f948f01ff434 to your computer and use it in GitHub Desktop.
Save painedpineapple/6175dfa0016330231967f948f01ff434 to your computer and use it in GitHub Desktop.
open Belt;
let str = React.string;
let rem_of_px = pixel => (pixel->float_of_int /. 16.)->Css.rem;
let createMarkup = str => <span dangerouslySetInnerHTML={"__html": str} />;
let unknownErrorMessage = "An unknown error has occurred.";
let mergeDeep = (items: array(array('a))) =>
items->Belt.Array.reduce([||], (acc, item) =>
acc->Belt.Array.concat(item)
);
let arrayKeepSome = array =>
array->Array.reduce([||], (acc, item) =>
switch (item) {
| None => acc
| Some(item) => Array.concat(acc, [|item|])
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment