Files
hoppscotch/packages/hoppscotch-app/helpers/functional/debug.ts
kyteinsky 0c96993cc0 fix: parsing of protocol correctly (#2088)
Co-authored-by: Liyas Thomas <hi@liyasthomas.com>
Co-authored-by: Andrew Bastin <andrewbastin.k@gmail.com>
Co-authored-by: liyasthomas <liyascthomas@gmail.com>
Co-authored-by: Rishabh Agarwal <45998880+RishabhAgarwal-2001@users.noreply.github.com>
2022-02-22 23:03:22 +05:30

23 lines
504 B
TypeScript

/**
* 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
}