From 7bd3ca051499f0388d58c4167e4c47612373c14f Mon Sep 17 00:00:00 2001 From: ZhanXiaoGe Date: Tue, 29 Oct 2024 18:01:14 +0800 Subject: [PATCH] fix: prevent extra leading whitespace in stopAndPersist when symbol is an empty string. --- index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index a91a0cf..3d5b8b8 100644 --- a/index.js +++ b/index.js @@ -358,7 +358,8 @@ class Ora { const symbolText = options.symbol ?? ' '; const text = options.text ?? this.text; - const fullText = (typeof text === 'string') ? ' ' + text : ''; + const separatorText = symbolText ? ' ' : ''; + const fullText = (typeof text === 'string') ? separatorText + text : ''; const suffixText = options.suffixText ?? this.#suffixText; const fullSuffixText = this.#getFullSuffixText(suffixText, ' ');