Skip to content

Commit

Permalink
refactor: reducing nesting in getBundleVars and formatting w prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
Varun0157 committed May 27, 2024
1 parent f26c6e1 commit 2e1b657
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/variableParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,12 @@ export function getBundleVariables(doc: string | undefined): Variables {
throw new Error("Bundle could not be parsed. Is your bundle a valid YAML document?");

const variables = parsedData.variables;
if (variables !== undefined) {
const error = checkVariables(variables);
if (error !== undefined) throw new Error(`error in variables: ${error}`);
if (variables === undefined) return {};

return variables;
} else {
return {};
}
const error = checkVariables(variables);
if (error !== undefined) throw new Error(`error in variables: ${error}`);

return variables;
}

export function getEnvironments(bundleContent: string | undefined, varFileContents: string[]): string[] {
Expand All @@ -58,7 +56,7 @@ export function getEnvironments(bundleContent: string | undefined, varFileConten
export function loadVariables(
envName: string | undefined,
bundleContent: string | undefined,
varFileContents: string[]
varFileContents: string[],
): Variables {
if (!envName) return {};

Expand Down

0 comments on commit 2e1b657

Please sign in to comment.