inspector-gadget

preconfigured nodejs util for inspecting, and customizing inspecting

7 个版本
安装
npm install inspector-gadget
yarn add inspector-gadget
pnpm add inspector-gadget
bun add inspector-gadget
README

inspector-gadget 🕵🗜⚙

NPM version MIT License fliphub flipfam

preconfigured nodejs util for inspecting, and customizing inspecting

inspectorGadget 🗜

configure what is exposed when inspecting

const {inspectorGadget} = require('inspector-gadget')
class Eh {
  constructor() {
    this.inspect = inspectorGadget(this, ['property-to-ignore'])
  }
}

inspector 🕵

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)

custom ⚙

const {custom} = require('inspector-gadget')

// disables
custom(false)

// re-enables
custom(true)

// changes to your value, be careful.
custom(() => {})

options

  • if it fails to inspect, it will 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
  • it also exports util, for your convenience in destructuring
版本列表
1.0.0 2017-04-04
0.1.8 2017-04-01
0.1.7 2017-03-29
0.1.5 2017-03-23
0.1.1 2017-03-15
0.1.0 2017-03-15