Skip to content

Commit

Permalink
feat: getFields
Browse files Browse the repository at this point in the history
  • Loading branch information
jy95 committed Apr 2, 2024
1 parent e759327 commit a1526ee
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,11 @@ export class FhirDosageUtils {
}

/**
* Turn a FHIR Dosage object into text
* From a single dosage, extract specific field(s) requested by user.
* Some use cases could request to split part of the object for given needs (quantity and timing separately)
*/
fromDosageToText(dos: Dosage): string {
getFields(dos: Dosage, ...order: DisplayOrder[]): string {
// iterate on each key and generate a string from each part
let order = this.config.displayOrder;
let parts = order
.map((entry) =>
fromDisplayOrderToResult({
Expand All @@ -196,6 +196,15 @@ export class FhirDosageUtils {
return parts.join(this.config.displaySeparator);
}

/**
* Turn a FHIR Dosage object into text
*/
fromDosageToText(dos: Dosage): string {
// iterate on each key and generate a string from each part
let order = this.config.displayOrder;
return this.getFields(dos, ...order);
}

/**
* Turn multiple FHIR Dosage object into text
*/
Expand Down

0 comments on commit a1526ee

Please sign in to comment.