feat(runtime): implement console.table()#4745
Closed
nullptr-cve wants to merge 1 commit intoboa-dev:mainfrom
Closed
feat(runtime): implement console.table()#4745nullptr-cve wants to merge 1 commit intoboa-dev:mainfrom
nullptr-cve wants to merge 1 commit intoboa-dev:mainfrom
Conversation
Adds `console.table(tabularData, properties?)` per the WHATWG console spec. Renders an ASCII box-drawing table to the logger with an `(index)` column plus one column per object property. For arrays of primitives, uses a `Values` column. The optional second argument filters which columns are shown. Falls back to `console.log` behaviour when `tabularData` is not an object. Includes four tests covering: array of primitives, array of objects, column filtering, and primitive fallback.
Test262 conformance changes
|
Member
|
Duplicate of #4690 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements
console.table(tabularData, properties?)per the WHATWG console spec.Behaviour
(index)column plus one column per object propertyValuescolumnpropertiesargument filters which columns are shownconsole.logbehaviour whentabularDatais not an objectObject.keys()to enumerate only enumerable own properties (correctly excludes e.g.Array.prototype.length)Example
Test plan
console_table_array_of_primitivesconsole_table_array_of_objectsconsole_table_with_properties_filterconsole_table_non_object_fallback