console: lazy load cli
PR-URL: https://github.com/nodejs/node/pull/20567 Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
This commit is contained in:
parent
3b5a7a3e19
commit
5dad1e45e9
@ -31,7 +31,6 @@ const {
|
||||
} = require('internal/errors');
|
||||
const { previewMapIterator, previewSetIterator } = require('internal/v8');
|
||||
const { Buffer: { isBuffer } } = require('buffer');
|
||||
const cliTable = require('internal/cli_table');
|
||||
const util = require('util');
|
||||
const {
|
||||
isTypedArray, isSet, isMap, isSetIterator, isMapIterator,
|
||||
@ -49,6 +48,9 @@ const {
|
||||
from: ArrayFrom,
|
||||
} = Array;
|
||||
|
||||
// Lazy loaded for startup performance.
|
||||
let cliTable;
|
||||
|
||||
// Track amount of indentation required via `console.group()`.
|
||||
const kGroupIndent = Symbol('kGroupIndent');
|
||||
|
||||
@ -329,6 +331,7 @@ Console.prototype.table = function(tabularData, properties) {
|
||||
(typeof tabularData !== 'object' && typeof tabularData !== 'function'))
|
||||
return this.log(tabularData);
|
||||
|
||||
if (cliTable === undefined) cliTable = require('internal/cli_table');
|
||||
const final = (k, v) => this.log(cliTable(k, v));
|
||||
|
||||
const inspect = (v) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user