UNPKG

util-ex

Version:

Browser-friendly enhanced util fully compatible with standard node.js

45 lines (44 loc) 1.76 kB
/** * Return a string representation of an object, including its properties and nested objects, with customizable options. * * Echos the value of a value. Try to print the value out * in the best way possible given the different types. * * @param {*} obj - The object to inspect. * @param {object|boolean=} opts - Customizable options to control the behavior of the inspection. If it's a boolean, it sets the "showHidden" option. * @param {boolean=false} opts.showHidden - Whether to show non-enumerable properties of objects. * @param {number=2} opts.depth - How many levels deep nested objects are inspected. * @param {boolean=false} opts.colors - Whether to color the output. * @param {boolean=true} opts.customInspect - Whether to inspect custom inspect functions on objects. * @returns {string} The formatted string representing the object. */ export function inspect(obj: any, opts?: (object | boolean) | undefined, ...args: any[]): string; export namespace inspect { namespace colors { let bold: number[]; let italic: number[]; let underline: number[]; let inverse: number[]; let white: number[]; let grey: number[]; let black: number[]; let blue: number[]; let cyan: number[]; let green: number[]; let magenta: number[]; let red: number[]; let yellow: number[]; } namespace styles { export let special: string; export let number: string; export let boolean: string; export let undefined: string; let _null: string; export { _null as null }; export let string: string; export let date: string; export let regexp: string; } } export default inspect;