From 73be18a4e795df1a2cd530a02cb3e0f0b16a52a7 Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 15 Sep 2020 16:41:13 +0200 Subject: [PATCH] update filtering undefined & null --- apps/remix-ide/src/app/panels/terminal.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/remix-ide/src/app/panels/terminal.js b/apps/remix-ide/src/app/panels/terminal.js index ad45927786..a00ab9c410 100644 --- a/apps/remix-ide/src/app/panels/terminal.js +++ b/apps/remix-ide/src/app/panels/terminal.js @@ -633,15 +633,18 @@ class Terminal extends Plugin { error: 'text-danger' }[mode] // defaults if (mode) { + const filterUndefined = (el) => el !== undefined && el !== null return function logger (args, scopedCommands, append) { - var types = args.map(type) - var values = javascriptserialize.apply(null, args).map(function (val, idx) { + var types = args.filter(filterUndefined).map(type) + var values = javascriptserialize.apply(null, args.filter(filterUndefined)).map(function (val, idx) { if (typeof args[idx] === 'string') val = args[idx] if (types[idx] === 'element') val = jsbeautify.html(val) return val }) + if (values.length) { append(yo`${values}`) } + } } else { throw new Error('mode is not supported') }