MELCloud & MELCloud Home API for Node.js - v48.2.0
    Preparing search index...

    Function mapResult

    • Transform the success branch of a Result while passing the failure branch through unchanged. Lets callers compose Result-returning calls with synchronous transforms (e.g. mapResult(await api.getEnergy(...), getChartLineOptions)) without unwrapping then re-wrapping by hand.

      Type Parameters

      • T
      • TResult

      Parameters

      • result: Result<T>

        The Result to transform.

      • fn: (value: T) => TResult

        Pure function applied to the success value.

      Returns Result<TResult>

      A new Result with the transformed value (success branch) or the original error (failure branch).