MVFv3 API Documentation
    Preparing search index...

    Type Parameters

    • T

    Implements

    • SomeBase<T>
    Index

    Constructors

    • Type Parameters

      • T

      Parameters

      • value: T

      Returns Some<T>

    Properties

    _tag: "Some" = 'Some'

    Accessors

    • get "[toStringTag]"(): string

      Returns string

    • get value(): T

      Returns T

    Methods

    • Returns IterableIterator<T>

    • Returns None if the option is None, otherwise returns other.

      Type Parameters

      • U = T

      Parameters

      Returns Option<U>

    • Maps an Option<T> to Option<U> by applying a function to a contained value, if present. This is a no-op if the option is None.

      Type Parameters

      • U = T

      Parameters

      Returns Option<U>

    • Maps an Option<T> to Promise<Option<U>> by applying a function to a contained value, if present. This is a no-op if the option is None.

      Type Parameters

      • U = T

      Parameters

      Returns Promise<Option<U>>

    • Returns true if the current option is equivalent to other.

      Parameters

      Returns boolean

    • Returns the option if it is a Some value, otherwise throws an error with the provided message.

      Parameters

      • message: string

      Returns T

    • Returns None if the option is None or the predicate fn returns false, otherwise returns the option.

      Parameters

      • fn: (value: T) => boolean

      Returns Option<T>

    • Calls fn if the option is a Some value. Useful for checking the contents of a Some while still being able to use it after in a chain.

      Parameters

      • fn: (value: T) => void

      Returns Option<T>

    • Calls fn if the option is a None value. Useful for checking the contents of a None while still being able to use it after in a chain.

      Parameters

      • fn: () => void

      Returns Option<T>

    • Returns true if the option is a None value.

      Returns this is None

    • Returns true if the option is a Some value.

      Returns this is Some<T>

    • Returns true if the option is a Some value and fn returns true for the contained value.

      Parameters

      • fn: (value: T) => boolean

      Returns this is Some<T>

    • Returns an iterator over the possibly contained value.

      Returns IterableIterator<T>

    • Maps an Option<T> to Option<U> by applying a function to a contained value, if present. This is a no-op if the option is None.

      Type Parameters

      • U = T

      Parameters

      • fn: (value: T) => undefined | null | U

      Returns Option<U>

    • Maps an Option<T> to Promise<Option<U>> by applying a function to a contained value, if present. This is a no-op if the option is None.

      Type Parameters

      • U = T

      Parameters

      • fn: (value: T) => Promise<undefined | null | U>

      Returns Promise<Option<U>>

    • Maps an Option<T> to Option<U> by applying a function to a contained value, if present. Otherwise, returns U.

      Type Parameters

      • U = T

      Parameters

      • fn: (value: T) => U
      • fallback: U

      Returns U

    • Maps an Option<T> to Promise<U> by applying a function to a contained value, if present. Otherwise, returns U.

      Type Parameters

      • U = T

      Parameters

      • fn: (value: T) => Promise<U>
      • fallback: U

      Returns Promise<U>

    • Maps an Option<T> to U by applying a function to a contained value, if present. Otherwise, calls the provided fallback function and returns the result.

      Type Parameters

      • U = T

      Parameters

      • fn: (value: T) => U
      • fallback: () => U

      Returns U

    • Maps an Option<T> to Promise<U> by applying a function to a contained value, if present. Otherwise, calls the provided fallback function and returns the result.

      Type Parameters

      • U = T

      Parameters

      • fn: (value: T) => Promise<U>
      • fallback: () => Promise<U>

      Returns Promise<U>

    • Transforms the Option<T> into a Result<T, E>, mapping Some(v) to Ok(v) and None to Err(error).

      Type Parameters

      • E

      Parameters

      • error: E

      Returns Result<T, E>

    • Transforms the Option<T> into a Result<T, E>, mapping Some(v) to Ok(v) and None to Err(fn()).

      Type Parameters

      • E

      Parameters

      • fn: () => E

      Returns Result<T, E>

    • Returns this option if it is Some, otherwise returns other.

      Type Parameters

      • U = T

      Parameters

      Returns Option<T | U>

    • Returns this option if it is Some, otherwise calls fn and returns the result.

      Type Parameters

      • U = T

      Parameters

      Returns Option<T | U>

    • Returns a string representation of the option for debugging purposes.

      Returns string

    • Unwraps the option, yielding the content of a Some.

      USE THIS SPARINGLY! It is generally better to use unwrapOr or map to handle situations you may be temped to .unwrap() in.

      Returns T

      if the option is None.

    • Unwraps the option, yielding the content of a Some, or returns fallback.

      Type Parameters

      • V = T

      Parameters

      • fallback: V

      Returns T | V

    • Unwraps the option, yielding the content of a Some, or calls fn and returns the result.

      Type Parameters

      • V = T

      Parameters

      • fn: () => V

      Returns T | V

    • Returns Some if one or the other is Some, but not both. Otherwise, returns None.

      Type Parameters

      • U = T

      Parameters

      Returns Option<T | U>

    • Zips this with another option. If both are Some, returns a Some with a tuple of the two values. Otherwise, returns None.

      Type Parameters

      • U

      Parameters

      Returns Option<[T, U]>

    • Zips this with another option, using the provided function to compute a new return value.If both are Some, returns a Some with the new value. Otherwise, returns None.

      Type Parameters

      • U
      • V

      Parameters

      Returns Option<V>