Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit bc6dbc3

Browse filesBrowse files
BridgeARMylesBorins
authored andcommitted
console: lazy load cli
PR-URL: #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>
1 parent 94d217f commit bc6dbc3
Copy full SHA for bc6dbc3

File tree

Expand file treeCollapse file tree

1 file changed

+4
-1
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-1
lines changed
Open diff view settings
Collapse file

‎lib/console.js‎

Copy file name to clipboardExpand all lines: lib/console.js
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ const {
3131
} = require('internal/errors');
3232
const { previewMapIterator, previewSetIterator } = require('internal/v8');
3333
const { Buffer: { isBuffer } } = require('buffer');
34-
const cliTable = require('internal/cli_table');
3534
const util = require('util');
3635
const {
3736
isTypedArray, isSet, isMap, isSetIterator, isMapIterator,
@@ -49,6 +48,9 @@ const {
4948
from: ArrayFrom,
5049
} = Array;
5150

51+
// Lazy loaded for startup performance.
52+
let cliTable;
53+
5254
// Track amount of indentation required via `console.group()`.
5355
const kGroupIndent = Symbol('kGroupIndent');
5456

@@ -325,6 +327,7 @@ Console.prototype.table = function(tabularData, properties) {
325327
(typeof tabularData !== 'object' && typeof tabularData !== 'function'))
326328
return this.log(tabularData);
327329

330+
if (cliTable === undefined) cliTable = require('internal/cli_table');
328331
const final = (k, v) => this.log(cliTable(k, v));
329332

330333
const inspect = (v) => {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.