From 23cab771b281bad773ad3ed27678f75eef886dae Mon Sep 17 00:00:00 2001 From: Zachary Bluedorn Date: Thu, 1 Oct 2020 11:19:46 -0400 Subject: [PATCH] Don't overwrite variables if the key is present. Affects variables with randomness --- src/eval.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/eval.ts b/src/eval.ts index bc4b8c7..e6476a7 100644 --- a/src/eval.ts +++ b/src/eval.ts @@ -276,9 +276,9 @@ function aggregateResults(results: Evaluation[][]): Evaluation[] { (acc, evaluation) => didFail(evaluation) ? (acc[evaluation.variable] = 'Error - check this variable\'s code', acc) - : acc[evaluation.variable] + : acc.hasOwnProperty(evaluation.variable) ? acc - : (acc[evaluation.variable] = evaluation.result || '', acc), + : (acc[evaluation.variable] = evaluation.result as string, acc), map); const eitherErrorOrEvaluationsMap = (evaluations: Evaluation[]) =>