Package: effect
Module: Option
Converts an Option into an Array.
When to use
Use when you need to pass an Option to array-based APIs or spread optional
values into collections.
Details
Some → single-element array [value]None → empty array []Example (Converting to an array)
import { Option } from "effect"
console.log(Option.toArray(Option.some(1)))
// Output: [1]
console.log(Option.toArray(Option.none()))
// Output: []
See
fromIterable for the inverse directionSignature
declare const toArray: <A>(self: Option<A>) => Array<A>
Since v2.0.0