quantify library

A type-safe library for units of measurement, providing elegant syntax for unit conversions.

Classes

Acceleration
Represents a quantity of acceleration.
AffineQuantity<T extends Unit<T>, Q extends AffineQuantity<T, Q>>
Base class for quantities whose conversions are affine instead of purely multiplicative.
Angle
Represents a quantity of a plane angle.
AngularVelocity
Represents a quantity of angular velocity (or rotational speed).
Area
Represents a quantity of area.
Current
Represents a quantity of electric current.
Density
Represents a quantity of density.
ElectricCharge
Represents a quantity of electric charge.
Energy
Represents a quantity of energy.
EnergyDensity
Represents a quantity of energy density.
Force
Represents a quantity of force.
Frequency
Represents a quantity of frequency.
FuelConsumption
Represents fuel consumption and fuel economy.
Information
Represents a physical quantity of digital information.
InverseQuantity<T extends Unit<T>, Q extends InverseQuantity<T, Q>>
Base class for quantities whose conversions route through a reciprocal canonical form.
Length
Represents a physical quantity of length.
LevelRatio
Represents a logarithmic level ratio such as gain or attenuation.
LinearQuantity<T extends LinearUnit<T>, Q extends LinearQuantity<T, Q>>
An abstract base class for physical quantities with linear (factor-based) unit conversions.
LinearUnit<T extends LinearUnit<T>>
A contract for units that scale linearly (via a simple multiplier).
LogarithmicQuantity<T extends Unit<T>, Q extends LogarithmicQuantity<T, Q>>
Base class for quantities that represent logarithmic levels of another physical dimension.
LuminousIntensity
Represents a quantity of luminous intensity.
Mass
Represents a physical quantity of mass.
MolarAmount
Represents a quantity of amount of substance, typically measured in moles.
Power
Represents a quantity of power.
PowerLevel
Represents an absolute logarithmic power level.
Pressure
Represents a quantity of pressure.
Quantity<T extends Unit<T>>
An abstract representation of a physical quantity, encapsulating a numerical value and a specific unit of measurement.
QuantityFormat
Immutable configuration for formatting and parsing a Quantity's numerical value and unit symbol.
QuantityParser<T extends Unit<T>, Q extends Quantity<T>>
An immutable, bulletproof parser for physical quantities.
Resistance
Represents a quantity of electrical resistance.
SolidAngle
Represents a quantity of solid angle.
SoundPressureLevel
Represents an absolute sound pressure level.
SpecificEnergy
Represents a quantity of specific energy.
Speed
Represents a quantity of speed (or velocity).
Temperature
Represents a quantity of temperature.
TemperatureDelta
A temperature change (interval), distinct from an absolute 'Temperature'.
Time
Represents a quantity of time (duration).
Torque
Represents a quantity of torque (rotational moment).
Unit<T extends Unit<T>>
A base contract for all unit enums.
Voltage
Represents a quantity of electric potential (voltage).
VoltageLevel
Represents an absolute logarithmic voltage level.
Volume
Represents a quantity of volume.
VolumetricFlowRate
Represents a quantity of volumetric flow rate.

Enums

AccelerationUnit
Represents units of acceleration.
AngleUnit
Represents units for a plane angle.
AngularVelocityUnit
Represents units for angular velocity.
AreaUnit
Represents units of area.
CurrentUnit
Represents units for electric current.
DensityUnit
Represents units of density.
ElectricChargeUnit
Represents units of electric charge.
EnergyDensityUnit
Represents units of energy density.
EnergyUnit
Represents units of energy.
ForceUnit
Represents units of force.
FrequencyUnit
Represents units of frequency.
FuelConsumptionUnit
Represents units of fuel consumption and fuel economy.
InformationUnit
Represents units of digital information.
LengthUnit
Represents units of length.
LevelRatioUnit
Represents units of logarithmic level ratio.
LuminousIntensityUnit
Represents units for luminous intensity.
MassUnit
Represents units of mass.
MolarUnit
Represents units for amount of substance (molar amount).
PowerLevelUnit
Represents units of absolute power level.
PowerUnit
Represents units of power.
PressureUnit
Represents units of pressure.
ResistanceUnit
Represents units for electrical resistance.
SolidAngleUnit
Represents units of solid angle.
SoundPressureLevelUnit
Represents units of sound pressure level.
SpecificEnergyUnit
Represents units of specific energy.
SpeedUnit
Represents units of speed.
TemperatureDeltaUnit
Represents units of temperature change (intervals/deltas).
TemperatureUnit
Represents units of temperature.
TimeUnit
Represents units of time.
TorqueUnit
Represents units of torque.
VoltageLevelUnit
Represents units of absolute logarithmic voltage level.
VoltageUnit
Represents units for electric potential (voltage).
VolumetricFlowRateUnit
Represents units of volumetric flow rate.
VolumeUnit
Represents units of volume.

Extensions

AccelerationCreation on num
Provides convenient factory methods for creating Acceleration instances from num.
AccelerationValueGetters on Acceleration
Provides convenient access to Acceleration values in specific units.
AngleCreation on num
Provides convenient factory methods for creating Angle instances from num.
AngleValueGetters on Angle
Provides convenient access to Angle values in specific units.
AngularVelocityCreation on num
Provides convenient factory methods for creating AngularVelocity instances from num.
AngularVelocityFrequencyInterop on AngularVelocity
Provides interoperability extensions between Frequency and AngularVelocity.
AngularVelocityValueGetters on AngularVelocity
Provides convenient access to AngularVelocity values in specific units.
AreaCreation on num
Provides convenient factory methods for creating Area instances from num using getter properties named after common unit symbols or names.
AreaValueGetters on Area
Provides convenient access to Area values in specific units using getter properties.
CurrentCreation on num
Provides convenient factory methods for creating Current instances from num using getter properties named after common unit symbols or names.
CurrentValueGetters on Current
Provides convenient access to Current values in specific units using getter properties.
DensityCreation on num
Provides convenient factory methods for creating Density instances from num.
DensityValueGetters on Density
Provides convenient access to Density values in specific units.
ElectricChargeCreation on num
Provides convenient factory methods for creating ElectricCharge instances from num.
ElectricChargeValueGetters on ElectricCharge
Provides convenient access to ElectricCharge values in specific units.
EnergyCreation on num
Provides convenient factory methods for creating Energy instances from num using getter properties named after common unit symbols or names.
EnergyDensityCreation on num
Provides convenient factory methods for creating EnergyDensity instances from num.
EnergyDensityValueGetters on EnergyDensity
Provides convenient access to EnergyDensity values in specific units.
EnergyValueGetters on Energy
Provides convenient access to Energy values in specific units using getter properties.
ForceCreation on num
Provides convenient factory methods for creating Force instances from num.
ForceValueGetters on Force
Provides convenient access to Force values in specific units.
FrequencyAngularVelocityInterop on Frequency
Provides interoperability extensions between Frequency and AngularVelocity.
FrequencyCreation on num
Provides convenient factory methods for creating Frequency instances from num.
FrequencyValueGetters on Frequency
Provides convenient access to Frequency values in specific units.
FuelConsumptionCreation on num
Provides convenient factory methods for creating FuelConsumption instances.
FuelConsumptionValueGetters on FuelConsumption
Provides convenient access to FuelConsumption values in specific units.
InformationCreation on num
Provides convenient factory methods for creating Information instances from num.
InformationValueGetters on Information
Provides convenient access to Information values in specific units.
LengthCreation on num
Provides convenient factory methods for creating Length instances from num using both SI unit symbols and full English words (singular and plural).
LengthValueGetters on Length
Provides convenient access to Length values in specific units using shortened unit names where appropriate.
LevelRatioCreation on num
Provides convenient factory methods for creating LevelRatio instances.
LevelRatioValueGetters on LevelRatio
Provides convenient access to LevelRatio values in specific units.
LuminousIntensityCreation on num
Provides convenient factory methods for creating LuminousIntensity instances from num using getter properties named after common unit symbols or names.
LuminousIntensityValueGetters on LuminousIntensity
Provides convenient access to LuminousIntensity values in specific units using getter properties.
MassCreation on num
Provides convenient factory methods for creating Mass instances from num using getter properties named after common unit symbols or names.
MassValueGetters on Mass
Provides convenient access to Mass values in specific units using getter properties.
MolarAmountCreation on num
Provides convenient factory methods for creating MolarAmount instances from num using getter properties named after common unit symbols or names.
MolarAmountValueGetters on MolarAmount
Provides convenient access to MolarAmount values in specific units using getter properties.
PowerCreation on num
Provides convenient factory methods for creating Power instances from num.
PowerLevelCreation on num
Provides convenient factory methods for creating PowerLevel instances.
PowerLevelPowerBridge on PowerLevel
Provides bridge helpers from PowerLevel back to Power.
PowerLevelValueGetters on PowerLevel
Provides convenient access to PowerLevel values in specific units.
PowerPowerLevelBridge on Power
Provides bridge helpers between Power and PowerLevel.
PowerValueGetters on Power
Provides convenient access to Power values in specific units using getter properties.
PressureCreation on num
Provides convenient factory methods for creating Pressure instances from num using shortened unit names where appropriate.
PressureSoundPressureLevelBridge on Pressure
Provides bridge helpers between Pressure and SoundPressureLevel.
PressureValueGetters on Pressure
Provides convenient access to Pressure values in specific units using shortened unit names where appropriate.
ResistanceCreation on num
Provides convenient factory methods for creating Resistance instances from num using getter properties named after common unit symbols or names.
ResistanceValueGetters on Resistance
Provides convenient access to Resistance values in specific units using getter properties.
SolidAngleCreation on num
Provides convenient factory methods for creating SolidAngle instances from num.
SolidAngleValueGetters on SolidAngle
Provides convenient access to SolidAngle values in specific units.
SoundPressureLevelCreation on num
Provides convenient factory methods for creating SoundPressureLevel instances.
SoundPressureLevelPressureBridge on SoundPressureLevel
Provides bridge helpers from SoundPressureLevel back to Pressure.
SoundPressureLevelValueGetters on SoundPressureLevel
Provides convenient access to SoundPressureLevel values.
SpecificEnergyCreation on num
Provides convenient factory methods for creating SpecificEnergy instances from num.
SpecificEnergyValueGetters on SpecificEnergy
Provides convenient access to SpecificEnergy values in specific units.
SpeedCreation on num
Provides convenient factory methods for creating Speed instances from num.
SpeedValueGetters on Speed
Provides convenient access to Speed values in specific units.
TemperatureCreation on num
Provides convenient factory methods for creating Temperature instances from num.
TemperatureDeltaCreation on num
Provides convenient factory methods for creating TemperatureDelta instances from num.
TemperatureDeltaTemperatureInterop on TemperatureDelta
Provides cross-type arithmetic between TemperatureDelta and Temperature.
TemperatureDeltaValueGetters on TemperatureDelta
Provides convenient access to TemperatureDelta values in specific units.
TemperatureValueGetters on Temperature
Provides convenient access to Temperature values in specific units.
TimeCreation on num
Provides convenient factory methods for creating Time instances from num.
TimeValueGetters on Time
Provides convenient access to Time values in specific units.
TorqueCreation on num
Provides convenient factory methods for creating Torque instances from num.
TorqueValueGetters on Torque
Provides convenient access to Torque values in specific units.
VoltageCreation on num
Provides convenient factory methods for creating Voltage instances from num using getter properties named after common unit symbols or names.
VoltageLevelCreation on num
Provides convenient factory methods for creating VoltageLevel instances.
VoltageLevelValueGetters on VoltageLevel
Provides convenient access to VoltageLevel values in specific units.
VoltageLevelVoltageBridge on VoltageLevel
Provides bridge helpers from VoltageLevel back to Voltage.
VoltageValueGetters on Voltage
Provides convenient access to Voltage values in specific units using getter properties.
VoltageVoltageLevelBridge on Voltage
Provides bridge helpers between Voltage and VoltageLevel.
VolumeCreation on num
Provides convenient factory methods for creating Volume instances from num using getter properties named after common unit symbols or names.
VolumetricFlowRateCreation on num
Provides convenient factory methods for creating VolumetricFlowRate instances from num.
VolumetricFlowRateValueGetters on VolumetricFlowRate
Provides convenient access to VolumetricFlowRate values in specific units.
VolumeValueGetters on Volume
Provides convenient access to Volume values in specific units using getter properties.

Typedefs

ElectricPotential = Voltage
Type alias for formal contexts where "Electric Potential" is preferred over "Voltage".

Exceptions / Errors

QuantityParseException
Thrown by Quantity.parse when no supplied format can parse the input.