fliphub-monorepo
Version:
the builder of builders
76 lines (60 loc) • 2.15 kB
Markdown
//img.shields.io/npm/v/inspector-gadget.svg
[ ]: https://npmjs.org/package/inspector-gadget
[ ]: http://img.shields.io/badge/license-MIT-blue.svg?style=flat
[ ]: https://spdx.org/licenses/MIT
[ ]: https://img.shields.io/gitter/room/fliphub/pink.svg
[ ]: https://gitter.im/fliphub/Lobby
[ ]: https://img.shields.io/badge/%F0%9F%8F%97%20%F0%9F%92%A0-flipfam-9659F7.svg
[ ]: https://www.npmjs.com/package/flipfam

> preconfigured nodejs util for inspecting, and customizing inspecting
configure what is exposed when inspecting
```js
const {inspectorGadget} = require('inspector-gadget')
class Eh {
constructor() {
this.inspect = inspectorGadget(this, ['property-to-ignore'])
}
}
```
```js
const {inspector} = require('inspector-gadget')
const inspected = inspector({
some: {
super: {
deep: {
data: {
with: {
colors: function() {
this.array = ['with inspection with colors pre configured']
}
}
}
}
}
}
})
console.log(inspected)
```
```js
const {custom} = require('inspector-gadget')
// disables
custom(false)
// re-enables
custom(true)
// changes to your value, be careful.
custom(() => {})
```
- if it fails to inspect, it will [javascript-stringify](https://www.npmjs.com/package/javascript-stringify)
- second arg is a number, how deep you want to go (default 30)
- 3rd arg is options to override pre-configured [nodejs util inspect options](https://nodejs.org/api/util.html#util_util_inspect_object_options)
- it also exports `util`, for your convenience in destructuring
[![NPM version][inspector-gadget-npm-image]][inspector-gadget-npm-url]
[![MIT License][license-image]][license-url]
[![fliphub][gitter-badge]][gitter-url]
[![flipfam][flipfam-image]][flipfam-url]
[ ]: https: