Stringify Javascript values to a string or pretty print HTML
npm install @poppinss/inspectConvert 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.
Install the package from npm registry as follows
``sh`
npm install @poppinss/object-inspect
`js`
const { inspect } = require('@poppinss/inspect')
inspect({ foo: 'bar', bar: 'baz' })
`js``
const { stringify } = require('@poppinss/inspect')
stringify.html({ foo: 'bar', bar: 'baz' })
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.