UNPKG

1.6 kBTypeScriptView Raw
1// Type definitions for prettyjson
2// Project: https://github.com/rafeca/prettyjson
3// Definitions by: Wael BEN ZID EL GUEBSI <https://github.com/benzid-wael/>
4// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
5
6/**
7 * Defines prettyjson version
8 */
9export declare var version: string;
10
11/**
12 * Render pretty json.
13 *
14 * @param data {any} Data to prettify.
15 * @param options {IOptions} Hash with different options to configure the renderer.
16 * @param indentation {number} Indentation size.
17 *
18 * @return {string} pretty serialized json data ready to display.
19 */
20export declare function render(data: any, options?: RendererOptions, indentation?: number): string;
21
22/**
23 * Render pretty json from a string.
24 *
25 * @param data {string} Serialized JSON data to prettify.
26 * @param options {IOptions} Hash with different options to configure the renderer.
27 * @param indentation {number} Indentation size.
28 *
29 * @return {string} pretty serialized json data ready to display.
30 */
31export declare function renderString(data: string, options?: RendererOptions, indentation?: number): string;
32
33export interface RendererOptions {
34 /**
35 * Define behavior for Array objects
36 */
37 emptyArrayMsg?: string | undefined; // default: (empty)
38 inlineArrays?: boolean | undefined;
39 noAlign?: boolean | undefined;
40
41 /**
42 * Color definition
43 */
44 noColor?: boolean | undefined;
45 keysColor?: string | undefined;
46 dashColor?: string | undefined;
47 numberColor?: string | undefined;
48 stringColor?: string | undefined;
49
50 defaultIndentation?: number | undefined;
51}