toNullable<T> function
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);