From 6bd58b46ff6505b8b22aff297ef2d38f90e3fbb9 Mon Sep 17 00:00:00 2001 From: Matei Adriel Date: Fri, 20 Dec 2019 14:46:53 +0200 Subject: [PATCH] typescript(option): docs: added the docs for the fromNullable helper Signed-off-by: prescientmoon --- typescript/option/docs/main.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) 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_**