@pathmaker-digital/pmd-utilities - v2.2.6
    Preparing search index...

    Function unwrapOr

    • Unwraps an Option type and returns the contained value if it exists. If the Option is "none", it returns the provided fallback value.

      Type Parameters

      • T

        The type of the value.

      Parameters

      • opt: Option<T>

        The Option to unwrap.

      • fallback: T

        The fallback value to return if opt is "none".

      Returns T

      The unwrapped value if present, or the fallback.

      const name = unwrapOr(Some("Bob"), "Anonymous"); // "Bob"
      const name2 = unwrapOr(None(), "Anonymous"); // "Anonymous"