# stringify-object-extract-functions

> Stringify an object/array like JSON.stringify just without all the double-quotes

Latest version **2.4.1** (published 2016-10-09) · BSD-2-Clause license · 0 weekly downloads

## Install

```sh
npm install stringify-object-extract-functions
pnpm add stringify-object-extract-functions
yarn add stringify-object-extract-functions
bun add stringify-object-extract-functions
```

## 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 | 2.4.1 |
| Published | 2016-10-09 |
| First published | 2016-10-09 |
| Weekly downloads | 0 |
| License | BSD-2-Clause |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.10.0 |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Vladimir Morulus |
| Maintainers | morulus |
| Keywords | object, stringify, pretty, print, dump, format, type, json |

## Links

- npm: https://www.npmjs.com/package/stringify-object-extract-functions
- Repository: https://github.com/morulus/stringify-object-extract-functions
- Homepage: https://github.com/morulus/stringify-object-extract-functions#readme
- Issues: https://github.com/morulus/stringify-object-extract-functions/issues
- npm.io page: https://npm.io/package/stringify-object-extract-functions

## Dependencies (2)

- [is-regexp](https://npm.io/package/is-regexp.md) ^1.0.0
- [is-plain-obj](https://npm.io/package/is-plain-obj.md) ^1.0.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

- 2.4.1 (latest) — 2016-10-09

## README

# stringify-object [![Build Status](https://secure.travis-ci.org/yeoman/stringify-object.svg?branch=master)](http://travis-ci.org/yeoman/stringify-object)

> Stringify an object/array like JSON.stringify just without all the double-quotes.

Useful for when you want to get the string representation of an object in a formatted way.

It also handles circular references and lets you specify quote type.


## Install

```
$ npm install --save stringify-object
```


## Usage

```js
var obj = {
	foo: 'bar',
	'arr': [1, 2, 3],
	nested: { hello: "world" }
};

var pretty = stringifyObject(obj, {
	indent: '  ',
	singleQuotes: false
});

console.log(pretty);
/*
{
	foo: "bar",
	arr: [
		1,
		2,
		3
	],
	nested: {
		hello: "world"
	}
}
*/
```


## API

### stringifyObject(input, [options])

Circular references will be replaced with `"[Circular]"`.

#### input

*Required*  
Type: `object`, `array`

#### options

##### indent

Type: `string`  
Default: `'\t'`

Choose the indentation you prefer.

##### singleQuotes

Type: `boolean`  
Default: `true`

Set to false to get double-quoted strings.

##### filter(obj, prop)

Type: `function`

Expected to return a boolean of whether to keep the object.

##### inlineCharacterLimit

Type: `number`
Default: undefined

When set, will inline values up to `inlineCharacterLimit` length for the sake
of more terse output.

For example, given the example at the top of the README:

```js
var obj = {
	foo: 'bar',
	'arr': [1, 2, 3],
	nested: { hello: "world" }
};

var pretty = stringifyObject(obj, {
	indent: '  ',
	singleQuotes: false,
	inlineCharacterLimit: 12
});

console.log(pretty);
/*
{
	foo: "bar",
	arr: [1, 2, 3],
	nested: {
		hello: "world"
	}
}
*/
```

As you can see, `arr` was printed as a one-liner because its string was shorter
than 12 characters.

##### extractFunctions

Type: `boolean`   
Default: `false`

Stringifies inner code of functions.

```js
var obj = {
	assets: function() { [foo, bar] }
}

var pretty = stringifyObject(obj, {
	extractFunctions: true
}
console.log(pretty);
/*
{
	assets: [foo, bar]
}
*/
```

## License

[BSD license](http://opensource.org/licenses/bsd-license.php) © Vladimir Kalmykov, Yeoman Team

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