Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.

string representations of objects in node and the browser

License

Notifications You must be signed in to change notification settings

poppinss/object-inspect

 
 

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

About

string representations of objects in node and the browser

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Languages

  • JavaScript 90.2%
  • HTML 9.8%