Skip to content

Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia

503 B
Raw Blame
/**
 * Logs the current value and returns the same value
 * @param x The value to log
 * @returns The parameter `x` passed to this
 */
export const trace = <T>(x: T) => {
  console.log(x)
  return x
}

/**
 * Logs the annotated current value and returns the same value
 * @param name The name of the log
 * @curried_param `x` The value to log
 * @returns The parameter `x` passed to this
 */
export const namedTrace =
  (name: string) =>
  <T>(x: T) => {
    console.log(`${name}:`, x)
    return x
  }