diff options
Diffstat (limited to 'bs5/universal/native/shared/Cx.re')
-rw-r--r-- | bs5/universal/native/shared/Cx.re | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/bs5/universal/native/shared/Cx.re b/bs5/universal/native/shared/Cx.re new file mode 100644 index 0000000..caafd0a --- /dev/null +++ b/bs5/universal/native/shared/Cx.re @@ -0,0 +1,21 @@ +let make = cns => + cns->Belt.List.keep(x => x !== "") |> String.concat(" ") |> String.trim; + +let ifTrue = (cn, x) => x ? cn : ""; + +let ifSome = (cn, x) => + switch (x) { + | Some(_) => cn + | None => "" + }; + +let mapSome = (x, fn) => + switch (x) { + | Some(x) => fn(x) + | None => "" + }; + +let unpack = + fun + | Some(x) => x + | None => ""; |