HED 8.5.0 allows SI modifiers on each component of a compound unit. Speed/3 cm-per-us (centimeters per microsecond) is valid because cm and us are each a modified symbol. hed-javascript currently rejects it.
Current behavior: when a unit has SIUnit, hed-javascript prepends each modifier to the whole unit string. For m-per-s this produces km-per-s, mm-per-s, and so on, which happens to accept some valid forms but rejects any form with a modifier on the second component.
Expected behavior: for a unit whose name contains -per- or ^, split the annotated unit on -per- and match each component against the schema component, allowing one SI symbol modifier in front of each. Exponents stay attached to their component.
Examples:
- valid:
Speed/3 cm-per-us, Speed/3 km-per-s, Acceleration/2 mm-per-s^2, Volume/2 mm^3
- invalid:
Speed/3 kmm-per-s (two modifiers), Speed/3 m-per-sec (not a symbol), Speed/3 m-per-S (wrong case)
Where: src/schema/entries.js, class SchemaUnit (constructor and validateUnit).
Tests: hed-tests case units-invalid-compound-units (commit e3fc564) covers this; add the same strings to tests/jsonTestData/tagParserTests.data.js.
Same change is needed in hed-typescript (src/schema/entries/unit.ts).
HED 8.5.0 allows SI modifiers on each component of a compound unit.
Speed/3 cm-per-us(centimeters per microsecond) is valid becausecmandusare each a modified symbol. hed-javascript currently rejects it.Current behavior: when a unit has
SIUnit, hed-javascript prepends each modifier to the whole unit string. Form-per-sthis produceskm-per-s,mm-per-s, and so on, which happens to accept some valid forms but rejects any form with a modifier on the second component.Expected behavior: for a unit whose name contains
-per-or^, split the annotated unit on-per-and match each component against the schema component, allowing one SI symbol modifier in front of each. Exponents stay attached to their component.Examples:
Speed/3 cm-per-us,Speed/3 km-per-s,Acceleration/2 mm-per-s^2,Volume/2 mm^3Speed/3 kmm-per-s(two modifiers),Speed/3 m-per-sec(not a symbol),Speed/3 m-per-S(wrong case)Where:
src/schema/entries.js, classSchemaUnit(constructor andvalidateUnit).Tests: hed-tests case
units-invalid-compound-units(commit e3fc564) covers this; add the same strings totests/jsonTestData/tagParserTests.data.js.Same change is needed in hed-typescript (
src/schema/entries/unit.ts).