Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

tap

import { tap } from "https://github.gh-proxy.cn/raw.githubusercontent.com/baetheus/fun/main/either.ts";

Execute a side effect on the Right value of an Either and return the original Either unchanged.

@example
import * as E from "./either.ts";
import { pipe } from "./fn.ts";

const logValue = (n: number) => console.log(`Value: ${n}`);
const errorValue = (e: string) => console.log(`Error: ${e}`);
const result1 = pipe(
  E.right(42),
  E.tap(logValue, errorValue)
);
// Logs: "Value: 42"
// Returns: Right(42)

const result2 = pipe(
  E.left("Something failed"),
  E.tap(logValue, errorValue)
);
// Logs: "Error: Something failed"
// Returns: Left("Something failed")
const tap: Tap<KindEither>;