Class MassUnit
Extends
Measurement.
Create a new mass measurement instance.
Defined in: MassUnit.js.
Constructor Attributes | Constructor Name and Description |
---|---|
MassUnit(options)
|
Method Attributes | Method Name and Description |
---|---|
<static> |
MassUnit.convert(to, from, mass)
Convert a mass to another measure.
|
Return the type of this measurement.
|
|
newUnit(params)
Return a new instance of this type of measurement.
|
Class Detail
MassUnit(options)
- Parameters:
- options
- {{unit:string,amount:number|string|undefined}} Options controlling the construction of this instance
Method Detail
<static>
{number|undefined}
MassUnit.convert(to, from, mass)
Convert a mass to another measure.
- Parameters:
- to
- {string} unit to convert to
- from
- {string} unit to convert from
- mass
- {number} amount to be convert
- Returns:
- {number|undefined} the converted amount
{string}
getMeasure()
Return the type of this measurement. Examples are "mass",
"length", "speed", etc. Measurements can only be converted
to measurements of the same type.
The type of the units is determined automatically from the units. For example, the unit "grams" is type "mass". Use the static call Measurement.getAvailableUnits to find out what units this version of ilib supports.
- Returns:
- {string} the name of the type of this measurement
{Measurement}
newUnit(params)
Return a new instance of this type of measurement.
- Parameters:
- {Object} params
- parameters to the constructor
- Returns:
- {Measurement} a measurement subclass instance