Add string handling for position
This commit is contained in:
@@ -92,7 +92,16 @@ class MeasurementContainer {
|
|||||||
if (!this._currentVariant) {
|
if (!this._currentVariant) {
|
||||||
throw new Error('Variant must be specified before position');
|
throw new Error('Variant must be specified before position');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Turn string positions into numeric values
|
||||||
|
if (typeof positionValue == "string") {
|
||||||
|
positionValue = positionValue == "upstream" ? Number.NEGATIVE_INFINITY : positionValue;
|
||||||
|
positionValue = positionValue == "atEquipment" ? 0.0 : positionValue;
|
||||||
|
positionValue = positionValue == "downstream" ? Number.POSITIVE_INFINITY : positionValue;
|
||||||
|
}
|
||||||
|
|
||||||
this._currentPosition = positionValue;
|
this._currentPosition = positionValue;
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user