JSPM

@poppinss/inspect

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 29664
  • Score
    100M100P100Q150691F
  • License MIT

Stringify Javascript values to a string or pretty print HTML

Package Exports

  • @poppinss/inspect

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@poppinss/inspect) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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