1 | # Installation
|
2 | > `npm install --save @types/serialize-javascript`
|
3 |
|
4 | # Summary
|
5 | This package contains type definitions for serialize-javascript (https://github.com/yahoo/serialize-javascript).
|
6 |
|
7 | # Details
|
8 | Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/serialize-javascript.
|
9 | ## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/serialize-javascript/index.d.ts)
|
10 | ````ts
|
11 | // Type definitions for serialize-javascript 5.0
|
12 | // Project: https://github.com/yahoo/serialize-javascript
|
13 | // Definitions by: François Nguyen <https://github.com/lith-light-g>
|
14 | // Pochodaydayup <https://github.com/Pochodaydayup>
|
15 | // undefined-moe <https://github.com/undefined-moe>
|
16 | // Piotr Błażejewicz <https://github.com/peterblazejewicz>
|
17 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
18 |
|
19 | declare namespace serializeJavascript {
|
20 | interface SerializeJSOptions {
|
21 | /**
|
22 | * This option is the same as the space argument that can be passed to JSON.stringify.
|
23 | * It can be used to add whitespace and indentation to the serialized output to make it more readable.
|
24 | */
|
25 | space?: string | number | undefined;
|
26 | /**
|
27 | * This option is a signal to serialize() that the object being serialized does not contain any function or regexps values.
|
28 | * This enables a hot-path that allows serialization to be over 3x faster.
|
29 | * If you're serializing a lot of data, and know its pure JSON, then you can enable this option for a speed-up.
|
30 | */
|
31 | isJSON?: boolean | undefined;
|
32 | /**
|
33 | * This option is to signal serialize() that we want to do a straight conversion, without the XSS protection.
|
34 | * This options needs to be explicitly set to true. HTML characters and JavaScript line terminators will not be escaped.
|
35 | * You will have to roll your own.
|
36 | */
|
37 | unsafe?: true | undefined;
|
38 | /**
|
39 | * This option is to signal serialize() that we do not want serialize JavaScript function.
|
40 | * Just treat function like JSON.stringify do, but other features will work as expected.
|
41 | */
|
42 | ignoreFunction?: boolean | undefined;
|
43 | }
|
44 | }
|
45 |
|
46 | /**
|
47 | * Serialize JavaScript to a superset of JSON that includes regular expressions and functions.
|
48 | * @param input data to serialize
|
49 | * @param options optional object
|
50 | * @returns serialized data
|
51 | */
|
52 | declare function serializeJavascript(
|
53 | input: any,
|
54 | options?: serializeJavascript.SerializeJSOptions | number | string,
|
55 | ): string;
|
56 |
|
57 | export = serializeJavascript;
|
58 |
|
59 | ````
|
60 |
|
61 | ### Additional Details
|
62 | * Last updated: Tue, 06 Jul 2021 16:34:36 GMT
|
63 | * Dependencies: none
|
64 | * Global values: none
|
65 |
|
66 | # Credits
|
67 | These definitions were written by [François Nguyen](https://github.com/lith-light-g), [Pochodaydayup](https://github.com/Pochodaydayup), [undefined-moe](https://github.com/undefined-moe), and [Piotr Błażejewicz](https://github.com/peterblazejewicz).
|
68 |
|
\ | No newline at end of file |