Skip to content

Commit 8aa1415

Browse files
committed
Merge branch 'Object.keysToArray-documentation' into Object-docs
2 parents ffc0a8f + 8856175 commit 8aa1415

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/Core__Object.res

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,20 @@ external is: ('a, 'a) => bool = "Object.is"
4545
@set_index external set: ({..}, string, 'a) => unit = ""
4646
@set_index external setSymbol: ({..}, Core__Symbol.t, 'a) => unit = ""
4747

48-
@val external keysToArray: {..} => array<string> = "Object.keys"
48+
/**
49+
`keysToArray` returns an array of an object's own enumerable string-keyed property names. See [ECMAScript Language Specification](https://tc39.es/ecma262/multipage/fundamental-objects.html#sec-object.keys)
50+
or [Object.keys on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys).
51+
52+
## Examples
53+
54+
```rescript
55+
{"a": 1, "b": 2}->Object.keysToArray // ["a", "b"]
56+
{"a": None}->Object.keysToArray // ["a"]
57+
Object.empty()->Object.keysToArray // []
58+
```
59+
*/
60+
@val
61+
external keysToArray: {..} => array<string> = "Object.keys"
4962

5063
@val external hasOwnProperty: ({..}, string) => bool = "Object.prototype.hasOwnProperty.call"
5164

0 commit comments

Comments
 (0)