new Measurement(value, unitopt)
Name | Type | Attributes | Description |
---|---|---|---|
value | object | The measurement's numeric value in the given unit or a $k.Attribute with base unit. | |
unit | $k.Unit | <optional> | The value's unit. If the first argument is a $k.Attribute, the attribute's value will be converted to this unit. If the first argument is a number or interval, this argument is mandatory. |
Methods
(static) parse(string, QuantityKindopt, languageopt)
Parses a string consisting of a sequence of values and unit symbols. If the parameter quantityKind is not set, the function tries to guess the quantity kind based on the unit symbols used.
Name | Type | Attributes | Description |
---|---|---|---|
string | string | The string representation of the measurement | |
QuantityKind | object | <optional> | The optional QuantityKind of the measurement |
language | language | <optional> | Language of the string |
- Since
- 5.4.2
baseValue() → {number}
- Since
- 5.4.2
- Deprecated
- This function is deprecated and might be removed in future releases
The value in relation to the unit with factor 1.
- Type:
- number
quantityKind() → {MeasurementScale}
Returns the quantity kind of the measurement.
- Since
- 5.4.2
- Type:
- MeasurementScale
toBaseUnit() → {$k.Measurement}
- Since
- 5.4.2
- Deprecated
- This function is deprecated and might be removed in future releases
A measurement of same absolut value in the measurements's base unit or undefined, if the measurement's quantity kind has no unit with factor 1.
- Type:
- $k.Measurement
toUnit(unit, languageopt) → {$k.Measurement}
Returns a measurement of same absolut value in the given unit.
Name | Type | Attributes | Description |
---|---|---|---|
unit | $k.Unit | The target unit | |
language | string | <optional> | Optional language to determine the target unit |
- Since
- 5.4.2
- Type:
- $k.Measurement
unit() → {MeasurementScale}
Returns the (base) unit of the measurement.
- Since
- 5.4.2
- Type:
- MeasurementScale
value(unitopt) → {number}
Name | Type | Attributes | Description |
---|---|---|---|
unit | $k.Unit | <optional> | Optional unit in which the measurement value is returned. |
- Since
- 5.4.0
Returns the value of the measurement.
- Type:
- number
valueOf()
The returned value is only applicable for comparison between measurements and has no other defined semantics.
valueString(unitsopt, languageopt) → {string}
Returns the string representation of the measurement. If the units parameter is not set, the measurement's unit or quantity kind is used.
Name | Type | Attributes | Description |
---|---|---|---|
units | array | <optional> | the units to use |
language | string | <optional> | the language to use |
- Since
- 5.4.0
- Type:
- string