File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -258,6 +258,29 @@ and aux_obj_compare (a: Obj.t) (b: Obj.t) =
258
258
| None , (Some _ ) -> 1
259
259
| (Some x ), (Some y ) -> compare x y in
260
260
res
261
+ (*
262
+ and aux_obj_compare (a: Obj.t) (b: Obj.t) : int = [%bs.raw {|
263
+ function (a, b) {
264
+ var min_key_lhs;
265
+ var min_key_rhs;
266
+ for (var key in a) {
267
+ if (!b.hasOwnProperty(key) || caml_compare(a[key], b[key]) > 0) {
268
+ if (!min_key_rhs || key < min_key_rhs) { min_key_rhs = key }
269
+ }
270
+ }
271
+ for (var key in b) {
272
+ if (!a.hasOwnProperty(key) || caml_compare(b[key], a[key]) > 0) {
273
+ if (!min_key_lhs || key < min_key_lhs) { min_key_lhs = key }
274
+ }
275
+ }
276
+ if (!min_key_lhs) { return !min_key_rhs ? 0 : 1}
277
+ if (!min_key_rhs) { return -1 }
278
+ return min_key_lhs < min_key_rhs ? -1 : 1
279
+ }
280
+ |}]
281
+ a b [@bs]
282
+ *)
283
+
261
284
262
285
type eq = Obj .t -> Obj .t -> bool
263
286
@@ -325,6 +348,24 @@ and aux_obj_equal (a: Obj.t) (b: Obj.t) =
325
348
O. for_in a do_key_a [@ bs];
326
349
if ! result then O. for_in b do_key_b [@ bs];
327
350
! result
351
+ (*
352
+ and aux_obj_equal (a: Obj.t) (b: Obj.t) : bool = [%bs.raw {|
353
+ function (a, b) {
354
+ for (var key in a) {
355
+ if (!b.hasOwnProperty(key)) {
356
+ return false
357
+ }
358
+ }
359
+ for (var key in b) {
360
+ if (!a.hasOwnProperty(key) || !caml_equal(a[key], b[key])) {
361
+ return false
362
+ }
363
+ }
364
+ return true
365
+ }
366
+ |}]
367
+ a b [@bs]
368
+ *)
328
369
329
370
let caml_equal_null (x : Obj.t ) (y : Obj.t Js.null ) =
330
371
match Js. nullToOption y with
You can’t perform that action at this time.
0 commit comments