toArray
If option is Some
, returns an array with value as single value, otherwise returns empty array.
Type
type toArray = <T>(option: Option<T>) => [] | [T]
Examples
import {toArray, Some} from 'fnxt/option';
toArray(Some(1)); // -> [1]
toArray(None); // -> []