Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/xnd/symbols/also.ts>default

JavaScript augmentations and supplements
Latest
variable default
import { default } from "https://deno.land/x/xnd@v3.0.2/symbols/also.ts";

Call some function on a value as its argument and then continue with the same value.

Useful for side operations (e.g. inserting logging statements within a chain of operations).

import also from "../also.ts";

function getId() {
  return crypto.randomUUID()[also]((id) => console.debug("generated id:", id));
}

instead of

function getId() {
  const id = crypto.randomUUID();
  console.debug("generated id:", id);
  return id;
}

type

symbol