You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/Core__Object.res
+9-13Lines changed: 9 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -27,28 +27,28 @@
27
27
/**
28
28
`freeze` freezes an object. Freezing an object makes existing properties non-writable and prevents extensions. Once an object is frozen, new properties cannot be be added, existing properties cannot be removed, and their values cannot be changed.
29
29
30
-
**Note:** `freeze` returns the same object that was passed in; it does not create a frozen copy. Any attempt to change a frozen object will fail, either silently or by throwing an exception.
30
+
**Note:** `freeze` returns the same object that was passed in; it does not create a frozen copy. Any attempt to change a frozen object will fail, either silently or by throwing an exception.
31
31
32
-
## Examples
32
+
See [ECMAScript Language Specification](https://tc39.es/ecma262/multipage/fundamental-objects.html#sec-object.isfrozen) and [Object.isFrozen on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isFrozen).
33
+
34
+
## Examples
33
35
34
36
```rescript
35
37
let obj = {"a": 1}
36
38
obj->Object.set("a", 2) // succeeds
37
39
obj->Object.freeze->ignore
38
40
obj->Object.set("a", 3) // fails
39
-
```
40
-
## Specifications
41
-
- [ECMAScript Language Specification](https://tc39.es/ecma262/multipage/fundamental-objects.html#sec-object.freeze)
42
-
- [Object.freeze on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze)
43
-
- [Updating objects in Rescript](https://rescript-lang.org/docs/manual/latest/object#update)
44
-
*/
41
+
```
42
+
*/
45
43
@val
46
44
externalfreeze: 'a=>'a="Object.freeze"
47
45
48
46
@valexternalisSealed: 'a=>bool="Object.isSealed"
49
47
/**
50
48
`isFrozen` determines if an object is frozen. An object is frozen if an only if it is not extensible, all its properties are non-configurable, and all its data properties are non-writable.
51
49
50
+
See [ECMAScript Language Specification](https://tc39.es/ecma262/multipage/fundamental-objects.html#sec-object.isfrozen) and [Object.isFrozen on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isFrozen).
51
+
52
52
## Examples
53
53
54
54
```rescript
@@ -57,11 +57,7 @@ let pointIsFrozen = point->Object.isFrozen // true
57
57
let fruit = {"name": "Apple" }
58
58
let fruitIsFrozen = fruit->Object.isFrozen // false
59
59
```
60
-
## Specifications
61
-
- [ECMAScript Language Specification](https://tc39.es/ecma262/multipage/fundamental-objects.html#sec-object.isfrozen)
62
-
- [Object.isFrozen on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isFrozen)
63
-
- [Updating objects in Rescript](https://rescript-lang.org/docs/manual/latest/object#update)
0 commit comments