Function Some

  • Creates a Some instance of Option containing the given value. This function is used to represent the presence of a value in an operation that may not always produce a value.

    Type Parameters

    • T extends NonUndefined

    Parameters

    • val: T

      The value to be wrapped in a Some Option.

    Returns SomeOption<T>

    An Option instance representing the presence of a value.

    const option = Some(42);
    console.log(option.unwrap()); // Outputs: 42