Skip to content

Commit 5cde1dd

Browse files
authored
docs(option): getUnsafe does not raise an exception (#131)
* docs(option): getUnsafe does not raise an exception * value -> opt
1 parent ae53771 commit 5cde1dd

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Core__Option.resi

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,18 +80,18 @@ Option.getExn(None) /* Raises an Error */
8080
let getExn: option<'a> => 'a
8181

8282
/**
83-
`getUnsafe(value)` returns `value`.
83+
`getUnsafe(opt)` returns `value` if `opt` is `Some(value)`, otherwise `undefined`.
8484
8585
## Examples
8686
8787
```rescript
8888
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`
9090
```
9191
92-
## Exceptions
92+
## Notes
9393
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.
9595
*/
9696
external getUnsafe: option<'a> => 'a = "%identity"
9797

0 commit comments

Comments
 (0)