Skip to content

Commit 5db75f0

Browse files
committed
cleaned up a bit
1 parent 8f1d753 commit 5db75f0

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/Core__Object.res

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
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, and strings are identical if they have the same value. `+0` and `-0` are distinct. NaN is equal to itself.
4+
`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 equal to itself.
55
66
**Note:** In most scenarios use `==` and `===`. If the type you want to compare by value has an `equals` function, use it.
77
@@ -10,6 +10,7 @@ The `==` operator [is different in ReScript than Javascript](https://rescript-la
1010
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).
1111
1212
## Examples
13+
1314
```rescript
1415
Object.is(25, 13) // false
1516
Object.is("abc", "abc") // true
@@ -18,17 +19,18 @@ Object.is(undefined, null) // false
1819
Object.is(-0.0, 0.0) // false
1920
Object.is(list{1, 2}, list{1, 2}) // false
2021
22+
Object.is([1, 2, 3], [1, 2, 3]) // false
23+
[1, 2, 3] == [1, 2, 3] // true
24+
[1, 2, 3] === [1, 2, 3] // false
25+
2126
let fruit = {"name": "Apple" }
2227
Object.is(fruit, fruit) // true
2328
Object.is(fruit, {"name": "Apple" }) // false
2429
fruit == {"name": "Apple" } // true
2530
fruit === {"name": "Apple" } // false
26-
27-
Object.is([1, 2, 3], [1, 2, 3]) // false
28-
[1, 2, 3] == [1, 2, 3] // true
29-
[1, 2, 3] === [1, 2, 3] // false
3031
```
3132
## Specifications
33+
3234
- [ECMAScript Language Specification](https://tc39.es/ecma262/multipage/fundamental-objects.html#sec-object.is)
3335
- [`Object.is on Mozilla`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is)
3436
- [Equality operators in ReScript](https://rescript-lang.org/docs/manual/latest/overview#boolean)

0 commit comments

Comments
 (0)