DefinitelyTyped/types/serialize-javascript/index.d.ts
Andy b6c343f2b3 Apply new lint rules to yet more packages (#15548)
* Apply new lint rules to yet more packages

* Fix leaflet lint
2017-03-31 11:01:26 -07:00

30 lines
1.3 KiB
TypeScript

// Type definitions for serialize-javascript 1.3
// Project: https://github.com/yahoo/serialize-javascript
// Definitions by: François Nguyen <https://github.com/lith-light-g>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace serializeJavascript {
interface SerializeJSOptions {
/**
* This option is the same as the space argument that can be passed to JSON.stringify.
* It can be used to add whitespace and indentation to the serialized output to make it more readable.
*/
space?: string | number | undefined;
/**
* This option is a signal to serialize() that the object being serialized does not contain any function or regexps values.
* This enables a hot-path that allows serialization to be over 3x faster.
* If you're serializing a lot of data, and know its pure JSON, then you can enable this option for a speed-up.
*/
isJSON?: boolean;
}
}
/**
* Serialize JavaScript to a superset of JSON that includes regular expressions and functions.
* @param {any} input data to serialize
* @param {serializeJavascript.SerializeJSOptions} options optional object
* @returns {string} serialized data
*/
declare function serializeJavascript(input: any, options?: serializeJavascript.SerializeJSOptions): string;
export = serializeJavascript;