// // Copyright 2026 DXOS.org // import { type CallMetadata } from './meta'; /** * Debug-log value to console. * Log's the expression being evaluated. * * If only one argument is provided, it will also be returned. * * @example * ```ts * dbg(foo, bar); * // foo = 1 * // bar = 2 * * bar = dbg(foo * 2); * // foo * 2 = 2 * ``` * * NOTE: The second argument is injected by the log transform plugin. */ export const dbg: { (value: T, _meta?: CallMetadata): T; } = (arg: T, meta?: CallMetadata): T => { if (meta?.A) { console.log(`${meta.A[0]} =`, arg); } else { console.log(arg); } return arg; };