Skip to content

Commit 217bb0e

Browse files
cjihrigtargos
authored andcommittedJan 1, 2019
lib: simplify several debug() calls
Avoid calling Array.prototype.join() in debug() calls. These are evaluated on every call, even if the debug() call is a no-op. This commit replaces the join() calls with the %j placeholder. PR-URL: #25241 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent e6b5232 commit 217bb0e

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed
 

‎lib/internal/http2/core.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -477,8 +477,8 @@ function onOrigin(origins) {
477477
const session = this[kOwner];
478478
if (session.destroyed)
479479
return;
480-
debug(`Http2Session ${sessionName(session[kType])}: origin received: ` +
481-
`${origins.join(', ')}`);
480+
debug('Http2Session %s: origin received: %j',
481+
sessionName(session[kType]), origins);
482482
session[kUpdateTimer]();
483483
if (!session.encrypted || session.destroyed)
484484
return undefined;

‎lib/internal/modules/esm/create_dynamic_module.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ const ArrayJoin = Function.call.bind(Array.prototype.join);
66
const ArrayMap = Function.call.bind(Array.prototype.map);
77

88
const createDynamicModule = (exports, url = '', evaluate) => {
9-
debug(
10-
`creating ESM facade for ${url} with exports: ${ArrayJoin(exports, ', ')}`
11-
);
9+
debug('creating ESM facade for %s with exports: %j', url, exports);
1210
const names = ArrayMap(exports, (name) => `${name}`);
1311

1412
const source = `

0 commit comments

Comments
 (0)