diff --git a/typescript/option/docs/main.md b/typescript/option/docs/main.md index 3e0d141..e2c05a2 100644 --- a/typescript/option/docs/main.md +++ b/typescript/option/docs/main.md @@ -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: (value: T | null) => Option +``` + +### 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_**