Interface: CompoundableUnit<F>
Defined in: src/sdk/math/NumberUnit.ts:742
A unit type that can be compounded.
Extends
Unit
<F
>
Type Parameters
Type Parameter |
---|
F extends string |
Properties
family
readonly
family:F
Defined in: src/sdk/math/NumberUnit.ts:693
This unit's family.
Inherited from
name
readonly
name:string
Defined in: src/sdk/math/NumberUnit.ts:696
This unit's name.
Inherited from
scaleFactor
readonly
scaleFactor:number
Defined in: src/sdk/math/NumberUnit.ts:744
The relative linear scale of this unit compared to the standard unit of the same family.
Methods
canConvert()
canConvert(
otherUnit
):boolean
Defined in: src/sdk/math/NumberUnit.ts:703
Checks whether conversions between this unit and another unit are possible.
Parameters
Parameter | Type | Description |
---|---|---|
otherUnit | Unit <string > | The other unit. |
Returns
boolean
Whether conversions between this unit and another unit are possible.
Inherited from
convertFrom()
convertFrom(
value
,fromUnit
):number
Defined in: src/sdk/math/NumberUnit.ts:721
Converts a value of another unit to this unit.
Parameters
Parameter | Type | Description |
---|---|---|
value | number | The value to convert. |
fromUnit | Unit <F > | The unit from which to convert. |
Returns
number
The converted value.
Throws
Error if attempting an invalid conversion.
Inherited from
convertTo()
convertTo(
value
,toUnit
):number
Defined in: src/sdk/math/NumberUnit.ts:712
Converts a value of this unit to another unit.
Parameters
Parameter | Type | Description |
---|---|---|
value | number | The value to convert. |
toUnit | Unit <F > | The unit to which to convert. |
Returns
number
The converted value.
Throws
Error if attempting an invalid conversion.
Inherited from
createNumber()
createNumber(
value
):NumberUnit
<F
,CompoundableUnit
<F
>>
Defined in: src/sdk/math/NumberUnit.ts:728
Creates a NumberUnit with a specified initial value of this unit type.
Parameters
Parameter | Type | Description |
---|---|---|
value | number | The numeric value of the new NumberUnit. |
Returns
NumberUnit
<F
, CompoundableUnit
<F
>>
A NumberUnit of this unit type.
Inherited from
equals()
equals(
other
):boolean
Defined in: src/sdk/math/NumberUnit.ts:736
Checks whether this unit is equal to another unit. Returns true if and only if the other unit belongs to the same family and has the same name as this unit.
Parameters
Parameter | Type | Description |
---|---|---|
other | Unit <string > | The other unit to which to compare. |
Returns
boolean
Whether this unit is equal to the comparison.