Skip to content

Commit

Permalink
refactor: resolveContextValue (#630)
Browse files Browse the repository at this point in the history
  • Loading branch information
nunogois authored Jun 19, 2024
1 parent 7649311 commit 46894e7
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,7 @@ export function createFallbackFunction(
}

export function resolveContextValue(context: Context, field: string): string | undefined {
if (context[field] !== undefined) {
return context[field]?.toString();
}
if (context.properties && context.properties[field] !== undefined) {
return context.properties[field]?.toString();
}
return undefined;
return context[field]?.toString() ?? context.properties?.[field]?.toString();
}

export function safeName(str: string = '') {
Expand Down

0 comments on commit 46894e7

Please sign in to comment.