Skip to content

util: support inspecting Map, Set, and Promise

Among other things, this makes working with ES6 containers bearable on the REPL.

Before:

> new Map([[1, "foo"], [null, "bar"], [{quux: 42}, undefined]])
{}

After:

> new Map([[1, "foo"], [null, "bar"], [{quux: 42}, undefined]])
Map { 1 => 'foo', null => 'bar', { quux: 42 } => undefined }

The output format is inspired by Chrome DevTools.

I would like to support inspecting promises but I do not know of a way to synchronously obtain the status and fulfillment value. If someone would like to point me in the right direction I can provide a followup PR. (see below)

Merge request reports

Loading