method Result.prototype.inspect
Result.prototype.inspect(fn: (value: T) => void): Result<T, E>

Performs a side effect on the Ok value without changing the Result.

Examples

Example 1

const result = fetchUser("123")
  .inspect(user => console.log("Fetched:", user))
  .map(user => user.name);

Parameters

fn: (value: T) => void

Function to call with the Ok value (if Ok)

Return Type

This Result, unchanged

Usage

import { Result } from "result/mod.ts";