Hi,
I need to print out objects with embedded functions ideally both to the
command line and as files.
const test = {
name: "test",
get: function() { return "test"; }
};
I need to print out a structure like the above with the function definition
to the console and also as
You’re going to need to write a custom serializer similar to util.inspect
to get this. Be forewarned, though, there’s a reason functions aren’t
displayed as their source by default: calling .toString() on a function
doesn’t include the closure environment for the function, so any lexically
defined
On Mon, 28 Jan 2019 at 20:19, Forrest Norvell wrote:
> You’re going to need to write a custom serializer similar to util.inspect
> to get this. Be forewarned, though, there’s a reason functions aren’t
> displayed as their source by default: calling .toString() on a function
> doesn’t include the
Oh this closure issue is really annoying !
Is there any way it can be fixed ?
Shall I raise an issue ?
Aaron
On Mon, 28 Jan 2019 at 20:26, Aaron Gray wrote:
> On Mon, 28 Jan 2019 at 20:19, Forrest Norvell wrote:
>
>> You’re going to need to write a custom serializer similar to util.in
I'm not sure that raising an issue can help you (and who would it be with?
Node's maintainers? the V8 team? TC39?), because you're running up against
a property of all languages with closures and lexical environments. This
isn't a JavaScript-specific problem; all dynamic languages that support
firs