Skip to content

Commit 3f7041f

Browse files
ogorhcagviegas
andauthored
fix: enhance parameter value handling in getParameterValue function (#631)
Co-authored-by: Antonio González Viegas <[email protected]>
1 parent 5c79467 commit 3f7041f

File tree

1 file changed

+9
-2
lines changed
  • packages/core/src/openbim/IDSSpecifications/src/importers

1 file changed

+9
-2
lines changed

packages/core/src/openbim/IDSSpecifications/src/importers/parameter.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,15 @@ export const getParameterValue = (
2323
if ("enumeration" in restriction) {
2424
result.type = "enumeration";
2525
const enumeration = restriction.enumeration.map(
26-
({ value }: { value: string }) =>
27-
parseNumericString ? value : String(value),
26+
({ value }: { value: string }) => {
27+
if (restriction.base.includes("string")) return String(value);
28+
if (
29+
restriction.base.includes("integer") ||
30+
restriction.base.includes("double")
31+
)
32+
return Number(value);
33+
return value;
34+
},
2835
);
2936
result.parameter = enumeration;
3037
}

0 commit comments

Comments
 (0)