mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 13:48:44 +02:00
lib,src: use V8 API for collection inspection
Use a new public V8 API for inspecting weak collections and collection iterators, rather than using V8-internal functions to achieve this. This currently comes with a slight modification of the output for inspecting iterators generated by `Set().entries()`. Fixes: https://github.com/nodejs/node/issues/20409 PR-URL: https://github.com/nodejs/node/pull/20719 Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
This commit is contained in:
parent
143a2f8d67
commit
70cc5da0f1
8 changed files with 47 additions and 92 deletions
|
@ -29,7 +29,7 @@ const {
|
|||
ERR_INVALID_ARG_VALUE,
|
||||
},
|
||||
} = require('internal/errors');
|
||||
const { previewMapIterator, previewSetIterator } = require('internal/v8');
|
||||
const { previewEntries } = process.binding('util');
|
||||
const { Buffer: { isBuffer } } = require('buffer');
|
||||
const util = require('util');
|
||||
const {
|
||||
|
@ -345,7 +345,7 @@ Console.prototype.table = function(tabularData, properties) {
|
|||
|
||||
const mapIter = isMapIterator(tabularData);
|
||||
if (mapIter)
|
||||
tabularData = previewMapIterator(tabularData);
|
||||
tabularData = previewEntries(tabularData);
|
||||
|
||||
if (mapIter || isMap(tabularData)) {
|
||||
const keys = [];
|
||||
|
@ -367,7 +367,7 @@ Console.prototype.table = function(tabularData, properties) {
|
|||
|
||||
const setIter = isSetIterator(tabularData);
|
||||
if (setIter)
|
||||
tabularData = previewSetIterator(tabularData);
|
||||
tabularData = previewEntries(tabularData);
|
||||
|
||||
const setlike = setIter || isSet(tabularData);
|
||||
if (setlike) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue