From 2b27261b71ff76feb250b7d227028a07ee6f220a Mon Sep 17 00:00:00 2001 From: larrywang0701 <113608053+larrywang0701@users.noreply.github.com> Date: Wed, 1 Nov 2023 17:35:38 +0800 Subject: [PATCH] Add files via upload --- src/bundles/repl/programmable_repl.ts | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/bundles/repl/programmable_repl.ts b/src/bundles/repl/programmable_repl.ts index 099bb7790..707b2ecc0 100644 --- a/src/bundles/repl/programmable_repl.ts +++ b/src/bundles/repl/programmable_repl.ts @@ -59,17 +59,11 @@ export class ProgrammableRepl { this.reRenderTab(); return; } - if (retVal === undefined) { - this.pushOutputString('undefined', COLOR_RUN_CODE_RESULT); - } else if (retVal === null) { - this.pushOutputString('null', COLOR_RUN_CODE_RESULT); - } else { - if (typeof (retVal) === 'string') { - retVal = `"${retVal}"`; - } - // Here must use plain text output mode because retVal contains strings from the users. - this.pushOutputString(retVal, COLOR_RUN_CODE_RESULT); + if (typeof (retVal) === 'string') { + retVal = `"${retVal}"`; } + // Here must use plain text output mode because retVal contains strings from the users. + this.pushOutputString(retVal, COLOR_RUN_CODE_RESULT); this.reRenderTab(); developmentLog('RunCode finished'); } @@ -81,7 +75,7 @@ export class ProgrammableRepl { // Rich text output method allow output strings to have html tags and css styles. pushOutputString(content : string, textColor : string, outputMethod : string = 'plaintext') { let tmp = { - content, + content: content === undefined ? 'undefined' : content === null ? 'null' : content, color: textColor, outputMethod, };