UNPKG

1.98 kBMarkdownView Raw
1# Installation
2> `npm install --save @types/prettyjson`
3
4# Summary
5This package contains type definitions for prettyjson (https://github.com/rafeca/prettyjson).
6
7# Details
8Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/prettyjson.
9## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/prettyjson/index.d.ts)
10````ts
11/**
12 * Defines prettyjson version
13 */
14export declare var version: string;
15
16/**
17 * Render pretty json.
18 *
19 * @param data {any} Data to prettify.
20 * @param options {IOptions} Hash with different options to configure the renderer.
21 * @param indentation {number} Indentation size.
22 *
23 * @return {string} pretty serialized json data ready to display.
24 */
25export declare function render(data: any, options?: RendererOptions, indentation?: number): string;
26
27/**
28 * Render pretty json from a string.
29 *
30 * @param data {string} Serialized JSON data to prettify.
31 * @param options {IOptions} Hash with different options to configure the renderer.
32 * @param indentation {number} Indentation size.
33 *
34 * @return {string} pretty serialized json data ready to display.
35 */
36export declare function renderString(data: string, options?: RendererOptions, indentation?: number): string;
37
38export interface RendererOptions {
39 /**
40 * Define behavior for Array objects
41 */
42 emptyArrayMsg?: string | undefined; // default: (empty)
43 inlineArrays?: boolean | undefined;
44 noAlign?: boolean | undefined;
45
46 /**
47 * Color definition
48 */
49 noColor?: boolean | undefined;
50 keysColor?: string | undefined;
51 dashColor?: string | undefined;
52 numberColor?: string | undefined;
53 stringColor?: string | undefined;
54
55 defaultIndentation?: number | undefined;
56}
57
58````
59
60### Additional Details
61 * Last updated: Tue, 07 Nov 2023 09:09:39 GMT
62 * Dependencies: none
63
64# Credits
65These definitions were written by [Wael BEN ZID EL GUEBSI](https://github.com/benzid-wael).
66
\No newline at end of file