Skip to content

Commit

Permalink
fix: remove console.time from toJsontataString
Browse files Browse the repository at this point in the history
  • Loading branch information
mechanik-daniel committed Sep 22, 2024
1 parent 5c760b5 commit 55ad119
Showing 1 changed file with 11 additions and 18 deletions.
29 changes: 11 additions & 18 deletions src/helpers/parser/toJsonataString.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import { getElementDefinition } from './getElementDefinition';
import { removeComments } from './removeComments';

export const toJsonataString = async (inExpr: string): Promise<string | undefined> => {
console.time('Parse to JSONATA');
let res: string | undefined;

// decrlare FLASH block variables:
Expand Down Expand Up @@ -432,22 +431,16 @@ export const toJsonataString = async (inExpr: string): Promise<string | undefine
return thrower.throwParseError(`Invalid path: '${currentFshPath}'`);
};

try {
const withoutComments: string = removeComments(inExpr);
let parsed: string = await parseFumeExpression(withoutComments);
if (!expressionHasFlash) {
res = withoutComments;
} else {
// check if expression starts with "("
const isEnclosed = parsed.trimStart().startsWith('(') && parsed.trimEnd().endsWith('(');
// parsed = parsed.includes('$__finalize') ? parsed : `${parsed}$__flashInstance := $__finalize($__flashInstance);`
parsed = !isEnclosed ? `(${parsed})` : parsed; // enclose in () if needed
res = parsed.includes('$__finalize') ? parsed : parsed + '~>$__finalize';
}
} catch (e) {
console.timeEnd('Parse to JSONATA');
throw (e);
};
console.timeEnd('Parse to JSONATA');
const withoutComments: string = removeComments(inExpr);
let parsed: string = await parseFumeExpression(withoutComments);
if (!expressionHasFlash) {
res = withoutComments;
} else {
// check if expression starts with "("
const isEnclosed = parsed.trimStart().startsWith('(') && parsed.trimEnd().endsWith('(');
// parsed = parsed.includes('$__finalize') ? parsed : `${parsed}$__flashInstance := $__finalize($__flashInstance);`
parsed = !isEnclosed ? `(${parsed})` : parsed; // enclose in () if needed
res = parsed.includes('$__finalize') ? parsed : parsed + '~>$__finalize';
}
return res;
};

0 comments on commit 55ad119

Please sign in to comment.