Skip to content

Commit 2ea8222

Browse files
committed
use Object.fromEntries to map console keys to noop
1 parent 92508fa commit 2ea8222

File tree

1 file changed

+1
-21
lines changed

1 file changed

+1
-21
lines changed

src/registry/routes/helpers/get-component.ts

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -491,27 +491,7 @@ export default function getComponent(conf: Config, repository: Repository) {
491491
(...args: unknown[]) => unknown
492492
>
493493
},
494-
console: conf.local ? console : {
495-
assert: _.noop,
496-
clear: _.noop,
497-
count: _.noop,
498-
countReset: _.noop,
499-
debug: _.noop,
500-
dir: _.noop,
501-
dirxml: _.noop,
502-
error: _.noop,
503-
group: _.noop,
504-
groupCollapsed: _.noop,
505-
groupEnd: _.noop,
506-
info: _.noop,
507-
log: _.noop,
508-
table: _.noop,
509-
time: _.noop,
510-
timeEnd: _.noop,
511-
timeLog: _.noop,
512-
trace: _.noop,
513-
warn: _.noop,
514-
},
494+
console: conf.local ? console : Object.fromEntries(Object.keys(console).map(key => [key, _.noop])),
515495
setTimeout,
516496
Buffer
517497
};

0 commit comments

Comments
 (0)