summaryrefslogtreecommitdiff
path: root/lib/internal/streams/buffer_list.js
diff options
context:
space:
mode:
authorRuben Bridgewater <ruben@bridgewater.de>2018-09-27 00:35:42 +0200
committerDaniel Bevenius <daniel.bevenius@gmail.com>2018-10-02 10:34:34 +0200
commit9c3c0f42739137e7f3b52f659427233ceb735b54 (patch)
treeca4018d41e23d9cdc96690b0e24d91457e1b1691 /lib/internal/streams/buffer_list.js
parent250957b61e99053d805724315361d8ab352f1204 (diff)
downloadandroid-node-v8-9c3c0f42739137e7f3b52f659427233ceb735b54.tar.gz
android-node-v8-9c3c0f42739137e7f3b52f659427233ceb735b54.tar.bz2
android-node-v8-9c3c0f42739137e7f3b52f659427233ceb735b54.zip
stream: improve buffer list inspection
This makes sure the indentation level is correct, no matter if the inspected buffer list is inspected on a deeper level and custom inspect options are now passed through to the actual inspection. PR-URL: https://github.com/nodejs/node/pull/23109 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'lib/internal/streams/buffer_list.js')
-rw-r--r--lib/internal/streams/buffer_list.js12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/internal/streams/buffer_list.js b/lib/internal/streams/buffer_list.js
index a72bf37a31..aa254309a0 100644
--- a/lib/internal/streams/buffer_list.js
+++ b/lib/internal/streams/buffer_list.js
@@ -158,8 +158,14 @@ module.exports = class BufferList {
return ret;
}
- [inspect.custom]() {
- const obj = inspect({ length: this.length });
- return `${this.constructor.name} ${obj}`;
+ // Make sure the linked list only shows the minimal necessary information.
+ [inspect.custom](_, options) {
+ return inspect(this, {
+ ...options,
+ // Only inspect one level.
+ depth: 0,
+ // It should not recurse.
+ customInspect: false
+ });
}
};