From b941c8c059012d6497553f564fe3cb5cd7b6f75c Mon Sep 17 00:00:00 2001 From: Sébastien Dailly Date: Fri, 9 Apr 2021 10:57:49 +0200 Subject: Update build --- lib/js_lib/array.ml | 14 ++++++++++++++ lib/js_lib/dune | 9 +++++++++ 2 files changed, 23 insertions(+) create mode 100755 lib/js_lib/array.ml create mode 100755 lib/js_lib/dune (limited to 'lib') diff --git a/lib/js_lib/array.ml b/lib/js_lib/array.ml new file mode 100755 index 0000000..e55f1e9 --- /dev/null +++ b/lib/js_lib/array.ml @@ -0,0 +1,14 @@ +open Js_of_ocaml + +(** Compare two arrays *) +let compare + : f:('a -> 'a -> bool Js.t) -> 'a Js.js_array Js.t -> 'a Js.js_array Js.t -> bool Js.t + = fun ~f arr1 arr2 -> + if arr1##.length <> arr2##.length then + Js._false + else + arr1##every + (Js.wrap_callback @@ fun elem i _ -> + Js.Optdef.case (Js.array_get arr2 i) + (fun () -> Js._false) + (fun elem2 -> f elem elem2)) diff --git a/lib/js_lib/dune b/lib/js_lib/dune new file mode 100755 index 0000000..131a4bf --- /dev/null +++ b/lib/js_lib/dune @@ -0,0 +1,9 @@ +(library + (name js_lib) + (libraries + brr + brr.note + js_of_ocaml + ) + (preprocess (pps js_of_ocaml-ppx)) +) -- cgit v1.2.3