# js-stringify

> Stringify an object so it can be safely inlined in JavaScript code

Latest version **1.0.2** (published 2015-09-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install js-stringify
pnpm add js-stringify
yarn add js-stringify
bun add js-stringify
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2015-09-28 |
| First published | 2014-12-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 19 |
| Author | ForbesLindesay |
| Maintainers | forbeslindesay |

## Links

- npm: https://www.npmjs.com/package/js-stringify
- Repository: https://github.com/jadejs/js-stringify
- Homepage: https://github.com/jadejs/js-stringify#readme
- Issues: https://github.com/jadejs/js-stringify/issues
- npm.io page: https://npm.io/package/js-stringify

## Recent versions

- 1.0.2 (latest) — 2015-09-28
- 1.0.1 — 2015-05-17
- 1.0.0 — 2014-12-19

## README

# js-stringify

Stringify an object so it can be safely inlined in JavaScript code

[![Build Status](https://img.shields.io/travis/jadejs/js-stringify/master.svg)](https://travis-ci.org/jadejs/js-stringify)
[![Dependency Status](https://img.shields.io/gemnasium/jadejs/js-stringify.svg)](https://gemnasium.com/jadejs/js-stringify)
[![NPM version](https://img.shields.io/npm/v/js-stringify.svg)](https://www.npmjs.org/package/js-stringify)

## Installation

    npm install js-stringify

## Usage

```js

var assert = require('assert');
var stringify = require('js-stringify');

assert(stringify('foo') === '"foo"');
assert(stringify('foo\u2028bar\u2029baz') === '"foo\\u2028bar\\u2029baz"');
assert(stringify(new Date('2014-12-19T03:42:00.000Z')) === 'new Date("2014-12-19T03:42:00.000Z")');
assert(stringify({foo: 'bar'}) === '{"foo":"bar"}');
assert(stringify(undefined) === 'undefined');
assert(stringify(null) === 'null');
assert(
  stringify({val: "</script><script>alert('bad actor')</script>"}) ===
  '{"val":"\\u003C\\u002Fscript\\u003E\\u003Cscript\\u003Ealert(\'bad actor\')\\u003C\\u002Fscript\\u003E"}'
);
```

## License

  MIT

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