toNullable<T> function

T? toNullable<T>(
  1. Option<T> option
)

Transforms the Option into a nullable value. Some unwraps to the value, while None becomes null.

expect(some('hello').chain(toNullable), 'hello');
expect(none().chain(toNullable), null);

Implementation

T? toNullable<T>(Option<T> option) => option._fold(() => null, identity);