Skip to content

Commit

Permalink
refactor: fromQuantityToString
Browse files Browse the repository at this point in the history
  • Loading branch information
jy95 committed May 4, 2024
1 parent 56d655c commit 054b12d
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/utils/fromQuantityToString.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export function fromQuantityToString({
const { fromFHIRQuantityUnitToString, language } = config;
let unit = fromFHIRQuantityUnitToString({ language, quantity });
let value = quantity.value || 1;
let comparatorCode = quantity.comparator;

let quantityString =
unit.length === 0
Expand All @@ -23,14 +24,11 @@ export function fromQuantityToString({
unit: unit,
});

let comparatorCode = quantity.comparator;
let comparatorString = isNotUndefined(comparatorCode)
? i18next.t(`quantityComparator:${comparatorCode}`)
: undefined;

if (!isNotUndefined(comparatorString)) {
if (!isNotUndefined(comparatorCode)) {
return quantityString;
}

let comparatorString = i18next.t(`quantityComparator:${comparatorCode}`);

return `${comparatorString} ${quantityString}`;
}

0 comments on commit 054b12d

Please sign in to comment.