Skip to content

Commit 1e2e296

Browse files
committed
hasOwnProperty docs
1 parent 16bbe60 commit 1e2e296

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/Core__Object.res

+14-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,20 @@ Object.empty()->Object.keysToArray // []
140140
@val
141141
external keysToArray: {..} => array<string> = "Object.keys"
142142

143-
@val external hasOwnProperty: ({..}, string) => bool = "Object.prototype.hasOwnProperty.call"
143+
/**
144+
`hasOwnProperty` determines whether the object has the specified property as its **own** property, as opposed to inheriting it. See [hasOwnProperty on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwnProperty)
145+
146+
## Examples
147+
148+
```rescript
149+
let point = {"x": 1, "y": 2}
150+
{"a": 1}->hasOwnProperty("a") // true
151+
{"a": 1}->hasOwnProperty("b") // false
152+
{"a": 1}->hasOwnProperty("toString") // false
153+
```
154+
*/
155+
@val
156+
external hasOwnProperty: ({..}, string) => bool = "Object.prototype.hasOwnProperty.call"
144157

145158
/**
146159
`seal` seals an object. Sealing an object prevents extensions and makes existing properties non-configurable. A sealed object has a fixed set of properties. Unlike `freeze`, values of existing properties can still be changed as long as they are writable.

0 commit comments

Comments
 (0)