Skip to content

Commit f8911da

Browse files
authored
Fix(sr): unit of sr num content item (#307)
1 parent 7852832 commit f8911da

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/sr/valueTypes.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,12 +320,15 @@ class NumContentItem extends ContentItem {
320320
"Option 'unit' is required for NumContentItem with 'value'."
321321
);
322322
}
323+
if (options.unit.constructor !== CodedConcept) {
324+
throw new Error("Option 'unit' must have type CodedConcept.");
325+
}
323326
const item = {};
324327
item.NumericValue = options.value;
325328
if (isFloat(options.value)) {
326329
item.FloatingPointValue = options.value;
327330
}
328-
item.MeasurementUnitsCodeSequence = options.unit;
331+
item.MeasurementUnitsCodeSequence = [options.unit];
329332
this.MeasuredValueSequence = [item];
330333
} else if (options.qualifier !== undefined) {
331334
if (

0 commit comments

Comments
 (0)