From 166bd44069e895084d0213e45ee8f9ba0e64fe17 Mon Sep 17 00:00:00 2001 From: Dragory <2606411+Dragory@users.noreply.github.com> Date: Fri, 11 Oct 2019 22:31:48 +0300 Subject: [PATCH] templateFormatter: fix newlines within function calls resulting in weird behavious --- src/templateFormatter.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/templateFormatter.ts b/src/templateFormatter.ts index 2449a5d9..e798b2ff 100644 --- a/src/templateFormatter.ts +++ b/src/templateFormatter.ts @@ -123,7 +123,7 @@ export function parseTemplate(str: string): ParsedTemplate { // We're parsing a number argument // The actual validation of whether this is a number is in dumpArg() currentVar._state.currentArg += char; - } else if (char === " ") { + } else if (/\s/.test(char)) { // Whitespace, ignore continue; } else if (char === '"') { @@ -317,7 +317,7 @@ const baseValues = { [from, to] = [to, from]; } - let randValue = seed != null ? new seedrandom(seed)() : Math.random(); + const randValue = seed != null ? new seedrandom(seed)() : Math.random(); return Math.round(randValue * (to - from) + from); },