File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -80,18 +80,18 @@ Option.getExn(None) /* Raises an Error */
80
80
let getExn : option <'a > => 'a
81
81
82
82
/**
83
- `getUnsafe(value )` returns `value`.
83
+ `getUnsafe(opt )` returns `value` if `opt` is `Some(value)`, otherwise `undefined `.
84
84
85
85
## Examples
86
86
87
87
```rescript
88
88
Option.getUnsafe(Some(3)) == 3
89
- Option.getUnsafe(None) // Raises an error
89
+ Option.getUnsafe(None: option<int> ) // Returns `undefined`, which is not a valid `int`
90
90
```
91
91
92
- ## Exceptions
92
+ ## Notes
93
93
94
- - This is an unsafe operation, it assumes `value` is neither `None` nor `Some(None(...)))`
94
+ - This is an unsafe operation. It assumes `value` is not `None`, and may cause undefined behaviour if it is.
95
95
*/
96
96
external getUnsafe : option <'a > => 'a = "%identity"
97
97
You can’t perform that action at this time.
0 commit comments