1.0.1 • Published 4 years ago

@poppinss/inspect v1.0.1

Weekly downloads
1,284
License
MIT
Repository
github
Last release
4 years ago

object-inspect

Fork of object-inspect to add support for newlines, indentation and slight modifications to the output.

Convert Javascript datatypes to their string representation. Handles every in-built data type including.

  • Objects
  • Arrays
  • BigInt
  • Symbols
  • Map/WeakMap
  • Set/WeakSet
  • Date
  • RegExp
  • Object literals
  • Classes
  • String
  • Boolean
  • Number
  • Null
  • Undefined
  • Error
  • Buffer

This module will be re-written from scratch soon. So please, do not send any PR's for improvements. However, feel free to report issues and they will be picked up during re-write.

Installation

Install the package from npm registry as follows

npm install @poppinss/object-inspect

Usage

const { inspect } = require('@poppinss/inspect')
inspect({ foo: 'bar', bar: 'baz' })

Pretty print to HTML

const { stringify } = require('@poppinss/inspect')
stringify.html({ foo: 'bar', bar: 'baz' })

Credits

To the original object-inspect package. 90% of the code is still the same, we have just made opinionated changes to suit it better to our needs.

I didn't created a PR for the original package, since the modifications are very specific to serve our use case.

License

MIT