@@ -16,26 +16,20 @@ number as a `bigint` if successfully parsed. Uncaught syntax exception otherwise
16
16
## Examples
17
17
18
18
```rescript
19
- /* returns 123n */
20
- BigInt.fromStringExn("123")
19
+ BigInt.fromStringExn("123")->assertEqual(123n)
21
20
22
- /* returns 0n */
23
- BigInt.fromStringExn("")
21
+ BigInt.fromStringExn("")->assertEqual(0n)
24
22
25
- /* returns 17n */
26
- BigInt.fromStringExn("0x11")
23
+ BigInt.fromStringExn("0x11")->assertEqual(17n)
27
24
28
- /* returns 3n */
29
- BigInt.fromStringExn("0b11")
25
+ BigInt.fromStringExn("0b11")->assertEqual(3n)
30
26
31
- /* returns 9n */
32
- BigInt.fromStringExn("0o11")
27
+ BigInt.fromStringExn("0o11")->assertEqual(9n)
33
28
34
29
/* catch exception */
35
- try {
36
- BigInt.fromStringExn("a")
37
- } catch {
38
- | Exn.Error(_error) => 0n
30
+ switch BigInt.fromStringExn("a") {
31
+ | exception Exn.Error(_error) => assert(true)
32
+ | _bigInt => assert(false)
39
33
}
40
34
```
41
35
*/
@@ -51,8 +45,7 @@ See [`toString`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Referen
51
45
## Examples
52
46
53
47
```rescript
54
- /* prints "123" */
55
- BigInt.toString(123n)->Console.log
48
+ BigInt.toString(123n)->assertEqual("123")
56
49
```
57
50
*/
58
51
external toString : (bigint , ~radix : int = ?) => string = "toString"
@@ -67,8 +60,7 @@ Returns a string with a language-sensitive representation of this BigInt value.
67
60
## Examples
68
61
69
62
```rescript
70
- /* prints "123" */
71
- BigInt.toString(123n)->Console.log
63
+ BigInt.toString(123n)->assertEqual("123")
72
64
```
73
65
*/
74
66
external toLocaleString : bigint => string = "toLocaleString"
0 commit comments