1 | /// <reference types="node" />
|
2 | import { InspectOptions } from 'util';
|
3 | import { StringifyAnyOptions, JsonStringifyFunction } from '@naturalcycles/js-lib';
|
4 | export interface InspectAnyOptions extends StringifyAnyOptions, InspectOptions {
|
5 | }
|
6 | /**
|
7 | * Just a convenience export of a const that fulfills the JsonStringifyFunction interface.
|
8 | */
|
9 | export declare const inspectAnyStringifyFn: JsonStringifyFunction;
|
10 | /**
|
11 | * Transforms ANY to human-readable string (via util.inspect mainly).
|
12 | * Safe (no error throwing).
|
13 | *
|
14 | * Correclty prints Errors, AppErrors, ErrorObjects: error.message + \n + inspect(error.data)
|
15 | *
|
16 | * Enforces max length (default to 10_000, pass 0 to skip it).
|
17 | *
|
18 | * Logs numbers as-is, e.g: `6`.
|
19 | * Logs strings as-is (without single quotes around, unlike default util.inspect behavior).
|
20 | * Otherwise - just uses util.inspect() with reasonable defaults.
|
21 | *
|
22 | * Returns 'empty_string' if empty string is passed.
|
23 | * Returns 'undefined' if undefined is passed (default util.inspect behavior).
|
24 | *
|
25 | * Based on `_stringifyAny` from `js-lib`, just replaced `JSON.stringify` with `util.inspect`.
|
26 | */
|
27 | export declare function inspectAny(obj: any, opt?: InspectAnyOptions): string;
|