@naturalcycles/nodejs-lib
Version:
Standard library for Node.js
31 lines (30 loc) • 812 B
TypeScript
export interface TableDiffOptions {
/**
* @default false
*/
logEmpty?: boolean;
/**
* @default undefined
*
* If set - values of each field will be stringified and limited to maxFieldLen.
*/
maxFieldLen?: number;
/**
* Title of the A column
* @default `a`
*/
aTitle?: string;
/**
* Title of the B column
* @default `b`
*/
bTitle?: string;
}
/**
* Compares 2 objects, logs their differences via `console.table`.
*
* If `logEmpty` is set will explicitly log that fact, otherwise will log nothing.
*
* Function is located in nodejs-lib (not js-lib), because it's planned to improve in the future and add e.g colors (via chalk).
*/
export declare function tableDiff(a: object, b: object, opt?: TableDiffOptions): void;