Skip to content

Support for prototype #14

Open
Open
@DanielSWolf

Description

@DanielSWolf

This package is great for creating debug output! I just compared it to a number of similar packages (eyes, jsenc, js-stringify, javascript-stringify, and stringify-object), and the output of object-inspect was by far the most helpful!

There is only one case where I'd love a bit more information, and that is when working with prototypes / ES2015 classes. Consider this code:

const str = require('object-inspect');

class Foo {
  constructor() {
    this.a = 1;
    this.b = 2;
    this.c = 42;
  }
}

console.log(str(new Foo()));

The output is { a: 1, b: 2, c: 42 }, so the information that this is an instance of class Foo gets lost.

I noticed that for certain built-in types like Map, you prefix the output with the class name. It would help me a lot if you could do the same for other prototypes. In my case, that would make the output Foo { a: 1, b: 2, c: 42 }.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions