1
Fork 0

typescript(option): docs: added the docs for the fromNullable helper

Signed-off-by: prescientmoon <git@moonythm.dev>
This commit is contained in:
Matei Adriel 2019-12-20 14:46:53 +02:00 committed by prescientmoon
parent 1f1afc0f28
commit 6bd58b46ff
Signed by: prescientmoon
SSH key fingerprint: SHA256:UUF9JT2s8Xfyv76b8ZuVL7XrmimH4o49p4b+iexbVH4

View file

@ -187,4 +187,23 @@ foldback(add, None, x) // x
foldback(add, Some(y), x) // x + y
```
# FromNullable
A function to create options from nullable values.
### Signature
```ts
const fromNullable: <T>(value: T | null) => Option<T>
```
### Usage
```ts
import { Some, None, fromNullable } from '@adrielus/option'
fromNullable(7) // Some(7)
fromNullable(null) // None
```
**_This is still work in progress, right now only covering about 60% of the library. Contributions are welcome_**