From 4f71b163eac2cddf91d6cc04008248140fe4f2ef Mon Sep 17 00:00:00 2001 From: Jason Casareno Date: Wed, 3 Aug 2022 16:18:15 -0700 Subject: [PATCH] Minor changes --- packages/hoppscotch-data/src/environment.ts | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/packages/hoppscotch-data/src/environment.ts b/packages/hoppscotch-data/src/environment.ts index 424a971a6..8124959f9 100644 --- a/packages/hoppscotch-data/src/environment.ts +++ b/packages/hoppscotch-data/src/environment.ts @@ -69,15 +69,10 @@ export function parseTemplateStringE( variables: Environment["variables"], myVariables?: Variables ) { - /* - if (!variables || !str ) { - return E.right(str) - } - */ - if (!variables || !str || !myVariables) { return E.right(str) } + let result = str let depth = 0 let errorBound = 0 @@ -97,11 +92,8 @@ export function parseTemplateStringE( ) errorBound++ } - if(depth > ENV_MAX_EXPAND_LIMIT && errorBound <= ENV_MAX_EXPAND_LIMIT) { - return E.right(result) - }else{ - return E.left(ENV_EXPAND_LOOP) - } + + return depth <= ENV_MAX_EXPAND_LIMIT && errorBound <= ENV_MAX_EXPAND_LIMIT ? E.right(result) : E.left(ENV_EXPAND_LOOP); } /**