We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f51067a commit cd6120eCopy full SHA for cd6120e
jscomp/runtime/caml_obj.ml
@@ -37,6 +37,14 @@ module O = struct
37
[%raw{|function(o,foo){
38
for (var x in o) { foo(x) }}
39
|}]
40
+
41
+ (**
42
+ JS objects are not guaranteed to have `Object` in their prototype
43
+ chain so calling `some_obj.hasOwnProperty(key)` can sometimes throw
44
+ an exception when dealing with JS interop. This mainly occurs when
45
+ objects are created via `Object.create(null)`. The only safe way
46
+ to call this function is directly, e.g. `Object.prototype.hasOwnProperty.call(some_obj, key)`.
47
+ *)
48
external hasOwnProperty :
49
t -> key -> bool = "call" [@@bs.scope ("Object", "prototype", "hasOwnProperty")] [@@bs.val]
50
external get_value : Obj.t -> key -> Obj.t = ""[@@bs.get_index]
0 commit comments