# @types/serialize-javascript

> TypeScript definitions for serialize-javascript

Latest version **5.0.4** (published 2023-11-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install @types/serialize-javascript
pnpm add @types/serialize-javascript
yarn add @types/serialize-javascript
bun add @types/serialize-javascript
```

## Health

**Score 45/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high maintenance score; popular repo; extremely popular.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 5.0.4 |
| Published | 2023-11-07 |
| First published | 2017-03-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 6.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51442 |
| Maintainers | types |

## Links

- npm: https://www.npmjs.com/package/@types/serialize-javascript
- Repository: https://github.com/DefinitelyTyped/DefinitelyTyped
- Homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/serialize-javascript
- npm.io page: https://npm.io/package/@types/serialize-javascript

## Recent versions

- 5.0.4 (latest) — 2023-11-07
- 5.0.2 (ts3.8) — 2021-12-24
- 5.0.1 (ts3.6) — 2021-07-06
- 5.0.0 (ts3.3) — 2020-12-03
- 4.0.0 (ts3.0) — 2020-07-16
- 1.5.0 (ts2.0) — 2018-10-15
- 5.0.3 — 2023-10-18
- 1.3.2 — 2017-10-25
- 1.3.1 — 2017-03-31
- 1.3.0 — 2017-03-29

## README

# Installation
> `npm install --save @types/serialize-javascript`

# Summary
This package contains type definitions for serialize-javascript (https://github.com/yahoo/serialize-javascript).

# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/serialize-javascript.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/serialize-javascript/index.d.ts)
````ts
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 | undefined;
        /**
         * This option is to signal serialize() that we want to do a straight conversion, without the XSS protection.
         * This options needs to be explicitly set to true. HTML characters and JavaScript line terminators will not be escaped.
         * You will have to roll your own.
         */
        unsafe?: true | undefined;
        /**
         * This option is to signal serialize() that we do not want serialize JavaScript function.
         * Just treat function like JSON.stringify do, but other features will work as expected.
         */
        ignoreFunction?: boolean | undefined;
    }
}

/**
 * Serialize JavaScript to a superset of JSON that includes regular expressions and functions.
 * @param input data to serialize
 * @param options optional object
 * @returns serialized data
 */
declare function serializeJavascript(
    input: any,
    options?: serializeJavascript.SerializeJSOptions | number | string,
): string;

export = serializeJavascript;

````

### Additional Details
 * Last updated: Tue, 07 Nov 2023 15:11:36 GMT
 * Dependencies: none

# Credits
These definitions were written by [Pochodaydayup](https://github.com/Pochodaydayup), [undefined-moe](https://github.com/undefined-moe), and [Piotr Błażejewicz](https://github.com/peterblazejewicz).

---
_Source: https://npm.io/package/@types/serialize-javascript · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
