# stringify-parse

> A tool like JSON.string and JSON.parse but can convert the type Function and RegExp in js object

Latest version **1.0.6** (published 2018-12-29) · ISC license · 0 weekly downloads

## Install

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

## 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.6 |
| Published | 2018-12-29 |
| First published | 2018-12-25 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 3.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | alex |
| Maintainers | bonjs |
| Keywords | stringify-parse, json, stringify, parse, format |

## Links

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

## Dependencies (1)

- [mocha](https://npm.io/package/mocha.md) ^5.2.0

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.0.6 (latest) — 2018-12-29
- 1.0.5 — 2018-12-29
- 1.0.4 — 2018-12-28
- 1.0.3 — 2018-12-25
- 1.0.2 — 2018-12-25

## README

# stringify-parse [![Build Status](https://travis-ci.org/bonjs/stringify-parse.svg?branch=master)](https://travis-ci.org/bonjs/stringify-parse) [![](https://img.shields.io/npm/v/stringify-parse.svg)](https://www.npmjs.com/package/stringify-parse) [![](https://img.shields.io/npm/l/stringify-parse.svg)](https://img.shields.io/npm/l/stringify-parse.svg)
### A tool like JSON.stringify and JSON.parse but could convert the type Function and RegExp in the js object.

Install
~~~bash
npm install stringify-parse
~~~

eg.
~~~javascript
let o = {
  name: 'stringify-parse',
  method: function() {
    console.log('this is a function');
  },
  reg: /\w+/
}
~~~

Now, I want to convert the object into string, if we use JSON.stringify, it will lost the property method and reg

~~~javascript
{"name":"demo","reg":{}}
~~~

This is not what we want. Now we can use the tool stringify-parse

~~~javascript
const stringifyParse = require('stringify-parse');
console.log(stringifyParse(o));
~~~

output:
~~~javascript
{"name":"demo","method":function() {
    console.log('this is a function');
  },"reg":/\w+/
~~~

Then we can use the method stringifyParse.parse to convert the json string into object.
~~~javascript
let str = `{"name":"demo","method":function() {
    console.log('this is a function');
  },"reg":/\w+/
 `;
console.log(stringifyParse.parse(str));
~~~

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