Skip to content

Commit da6197a

Browse files
committed
reference to rescript docs, +0/-0, small tweaks
1 parent 7da0d96 commit da6197a

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/Core__Object.res

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
@obj external empty: unit => {..} = ""
22

33
/**
4-
`Object.is` determines if two objects are identical in all contexts. Objects, arrays, records, and other non-primitives are only identical if they reference the **exact** same object in memory. Primitives like ints, floats, bools, and strings are identical if they have the same value.
4+
`Object.is` determines if two objects are identical in all contexts. Objects, arrays, records, and other non-primitives are only identical if they reference the **exact** same object in memory. Primitives like ints, floats, and strings are identical if they have the same value. `+0` and `-0` are distinct. NaN is
5+
equal to itself.
56
6-
**Note:** In most scenarios use `==` and `===`. If the data type you want to compare by value has an `equals` function, use it.
7+
**Note:** In most scenarios use `==` and `===`. If the type you want to compare by value has an `equals` function, use it.
78
8-
The `==` operator is different in ReScript than Javascript. Non-primitives like arrays and records are considered equal if they have the same contents.
9+
The `==` operator [is different in ReScript than Javascript](https://rescript-lang.org/docs/manual/latest/overview#boolean). Arrays, records and other non-primitives are equal if they have the same contents (deep equality).
910
10-
In ReScript, the `===` operator performs a strict equality check, like Javascript, and is similar to (but not idential to) `Object.is`. See the references.
11+
In ReScript, the `===` operator performs a strict equality check, like Javascript, and is similar but not identical to `Object.is`; see [Mozilla](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is).
1112
1213
## Examples
1314
```rescript
@@ -31,6 +32,7 @@ Object.is([1, 2, 3], [1, 2, 3]) // false
3132
## Specifications
3233
- [ECMAScript Language Specification](https://tc39.es/ecma262/multipage/fundamental-objects.html#sec-object.is)
3334
- [`Object.is on Mozilla`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is)
35+
- [Equality operators in ReScript](https://rescript-lang.org/docs/manual/latest/overview#boolean)
3436
*/
3537
@val
3638
external is: ('a, 'b) => bool = "Object.is"

0 commit comments

Comments
 (0)