# inspect-1-line

> Collapse the node.js util.inspect output to 1 line and colorizes iff NODE_ENV is debug and adds inspect to the global object.

Latest version **2.0.0** (published 2017-12-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install inspect-1-line
pnpm add inspect-1-line
yarn add inspect-1-line
bun add inspect-1-line
```

## 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.0.0 |
| Published | 2017-12-21 |
| First published | 2016-05-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Edmond Meinfelder |
| Maintainers | stdarg |
| Keywords | node, util, inspect, 1, line, json, format, pretty, print |

## Links

- npm: https://www.npmjs.com/package/inspect-1-line
- Repository: https://github.com/stdarg/inspect-1-line
- Homepage: https://github.com/stdarg/inspect-1-line#readme
- Issues: https://github.com/stdarg/inspect-1-line/issues
- npm.io page: https://npm.io/package/inspect-1-line

## 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.0.0 (latest) — 2017-12-21
- 1.0.4 — 2016-05-09
- 1.0.2 — 2016-05-06
- 1.0.1 — 2016-05-06
- 1.0.0 — 2016-05-06

## README

inspect-1-line
===
This modules makes inspect from the Node.js utils easier for me to use by:

* adding it to the global object as global.inspect, callable as `inspect()`
* adding colors automatically if `NODE_ENV` is development (case unimportant)
* removes `\r`'s and `\n`'s from the string, making the output exist on 1-line (hence the name)
* optional args for depth or show hiiden that are detected by argument type
    * if the type is `bool`, it assumes the argument is `showHidden`
    * if the type is `number` or `null`, it assumes the argument is `depth`

## Installation
To install inspect-1-line, type:

  $ npm install --save inspect-1-line

## Usage

```javascript
inspect(val [ ,depth ]  [, showHidden ])
```

The arguments `depth` and `showHidden` are detected by type, not order. So,
order is not important.

```javascript
require('inspect-1-line');

var a = {
    b: 22,
    c: 'hello',
    d: true,
    e: {
        f: 'nesting',
        g: null,
    },
    h: {
        i: 'hello',
        j: {
            k: {
                l: 'we must go deeper',
                m: {
                    n: 'we must go deeper'
                }
            }
        }
    }
};
Object.defineProperty(a, 'e', { enumerable: false });  // hide property 'e'

console.log(inspect(a));
console.log(inspect(a, 3));
console.log(inspect(a, null, true));
```

The above has the following output:

```javascript
{ b: 22, c: 'hello', d: true, h: { i: 'hello', j: { k: [Object] } } }
{ b: 22, c: 'hello', d: true, h: { i: 'hello', j: { k: { l: 'we must go deeper', m: [Object] } } } }
{ b: 22, c: 'hello', d: true, [e]: { f: 'nesting', g: null }, h: { i: 'hello', j: { k: { l: 'we must go deeper', m: { n: 'we must go deeper' } } } } }
```

## License
The MIT License (MIT)

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

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