Skip to content

Conversation

@james-ha-bruno
Copy link
Contributor

Description

This PR improves the display of JavaScript Map and Set objects in Bruno's developer console to match Postman's cleaner, more user-friendly implementation.

Changes

Map Display Improvements

  • ✅ Removed [[Map]] wrapper property
  • ✅ Display Map entries directly at top level with => notation (e.g., "key =>": "value")
  • ✅ Removed size property from display
  • ✅ Added "Map" type label for clarity
  • ✅ Collapse by default for cleaner console output

Set Display Improvements

  • ✅ Removed [[Set]] wrapper property
  • ✅ Display Set values directly at top level with numeric indices (0, 1, 2, ...)
  • ✅ Removed size property from display
  • ✅ Added "Set" type label for clarity
  • ✅ Collapse by default for cleaner console output

Implementation Details

Modified Function: transformBrunoTypes()

  • Enhanced to support metadata tracking via optional returnMetadata parameter
  • Returns { data, metadata } when metadata is requested
  • Metadata includes type information ('Map', 'Set', etc.)

Modified Function: formatMessage()

  • Uses metadata to determine display name and collapse behavior
  • Sets name prop to 'Map' or 'Set' for type identification
  • Sets collapsed prop to true for Maps and Sets (collapse by default)
  • Maintains collapsed={1} for regular objects (collapse at depth 1)

Testing

Tested with post-response script logging Set and Map objects:

  • ✅ Sets display with numeric indices at top level
  • ✅ Maps display with => notation at top level
  • ✅ Both collapse by default
  • ✅ Type labels clearly identify object types
  • ✅ Expandable/collapsible UI works correctly

Demo

set - maps console log update

Contribution Checklist:

Note: Keeping the PR small and focused helps make it easier to review and merge. If you have multiple changes you want to make, please consider submitting them as separate pull requests.

Publishing to New Package Managers

Please see here for more information.

- Remove size property from Map and Set displays
- Display Set values at top level with numeric indices (0, 1, 2, ...)
- Display Map entries at top level with => notation (key =>: value)
- Remove [[Set]] and [[Map]] wrapper properties for cleaner display
- Collapse Maps and Sets by default in console (matching Postman behavior)
- Add 'Map' and 'Set' type labels to clearly identify object types
- Maintain expandable/collapsible UI for easy inspection of contents
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant