happy-rusty
    Preparing search index...

    Function Some

    • Creates an Option<T> representing the presence of a value. This function is typically used to construct an Option that contains a value, indicating that the operation yielding the value was successful.

      Type Parameters

      • T

        The type of the value to be wrapped in a Some.

      Parameters

      • value: T

        The value to wrap as a Some option.

      Returns Option<T>

      An Option<T> that contains the provided value, representing the Some case.

      1.0.0

      const maybeValue = Some(1); // Option<number> with a value
      if (maybeValue.isSome()) {
      console.log(maybeValue.unwrap()); // Outputs: 1
      }