diff --git a/typescript/option/src/helpers.ts b/typescript/option/src/helpers.ts index fb87ce1..09a419f 100644 --- a/typescript/option/src/helpers.ts +++ b/typescript/option/src/helpers.ts @@ -105,3 +105,7 @@ export const flat = <T, U>(option: Option<T>): Option<U> => { always(None) ) } + +export const fromNullable = <T>(value: null | T): Option<T> => { + return value === null ? None : Some(value) +}