@naturalcycles/nodejs-lib
Version:
Standard library for Node.js
34 lines (33 loc) • 883 B
TypeScript
import { AnyObject } from '@naturalcycles/js-lib';
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: AnyObject, b: AnyObject, opt?: TableDiffOptions): void;