UNPKG

unitsnet-js

Version:

A better way to hold unit variables and easily convert to the destination unit

603 lines (602 loc) 29 kB
import { BaseUnit, ToStringOptions } from "../base-unit"; /** API DTO represents a Energy */ export interface EnergyDto { /** The value of the Energy */ value: number; /** The specific unit that the Energy value is representing */ unit: EnergyUnits; } /** EnergyUnits enumeration */ export declare enum EnergyUnits { /** */ Joules = "Joule", /** */ Calories = "Calorie", /** */ BritishThermalUnits = "BritishThermalUnit", /** In physics, an electronvolt (symbol eV, also written electron-volt and electron volt) is the measure of an amount of kinetic energy gained by a single electron accelerating from rest through an electric potential difference of one volt in vacuum. When used as a unit of energy, the numerical value of 1 eV in joules (symbol J) is equivalent to the numerical value of the charge of an electron in coulombs (symbol C). Under the 2019 redefinition of the SI base units, this sets 1 eV equal to the exact value 1.602176634×10−19 J. */ ElectronVolts = "ElectronVolt", /** A pound-foot (lb⋅ft), abbreviated from pound-force foot (lbf · ft), is a unit of torque representing one pound of force acting at a perpendicular distance of one foot from a pivot point. Conversely one foot pound-force (ft · lbf) is the moment about an axis that applies one pound-force at a radius of one foot. */ FootPounds = "FootPound", /** The erg is a unit of energy equal to 10−7 joules (100 nJ). It originated in the Centimetre–gram–second system of units (CGS). It has the symbol erg. The erg is not an SI unit. Its name is derived from ergon (ἔργον), a Greek word meaning 'work' or 'task'. */ Ergs = "Erg", /** */ WattHours = "WattHour", /** */ WattDays = "WattDay", /** The therm (symbol, thm) is a non-SI unit of heat energy equal to 100,000 British thermal units (BTU), and approximately 105 megajoules, 29.3 kilowatt-hours, 25,200 kilocalories and 25.2 thermies. One therm is the energy content of approximately 100 cubic feet (2.83 cubic metres) of natural gas at standard temperature and pressure. However, the BTU is not standardised worldwide, with slightly different values in the EU, UK, and United States, meaning that the energy content of the therm also varies by territory. */ ThermsEc = "ThermEc", /** The therm (symbol, thm) is a non-SI unit of heat energy equal to 100,000 British thermal units (BTU), and approximately 105 megajoules, 29.3 kilowatt-hours, 25,200 kilocalories and 25.2 thermies. One therm is the energy content of approximately 100 cubic feet (2.83 cubic metres) of natural gas at standard temperature and pressure. However, the BTU is not standardised worldwide, with slightly different values in the EU, UK, and United States, meaning that the energy content of the therm also varies by territory. */ ThermsUs = "ThermUs", /** The therm (symbol, thm) is a non-SI unit of heat energy equal to 100,000 British thermal units (BTU), and approximately 105 megajoules, 29.3 kilowatt-hours, 25,200 kilocalories and 25.2 thermies. One therm is the energy content of approximately 100 cubic feet (2.83 cubic metres) of natural gas at standard temperature and pressure. However, the BTU is not standardised worldwide, with slightly different values in the EU, UK, and United States, meaning that the energy content of the therm also varies by territory. */ ThermsImperial = "ThermImperial", /** A horsepower-hour (symbol: hp⋅h) is an outdated unit of energy, not used in the International System of Units. The unit represents an amount of work a horse is supposed capable of delivering during an hour (1 horsepower integrated over a time interval of an hour). */ HorsepowerHours = "HorsepowerHour", /** */ Nanojoules = "Nanojoule", /** */ Microjoules = "Microjoule", /** */ Millijoules = "Millijoule", /** */ Kilojoules = "Kilojoule", /** */ Megajoules = "Megajoule", /** */ Gigajoules = "Gigajoule", /** */ Terajoules = "Terajoule", /** */ Petajoules = "Petajoule", /** */ Kilocalories = "Kilocalorie", /** */ Megacalories = "Megacalorie", /** */ KilobritishThermalUnits = "KilobritishThermalUnit", /** */ MegabritishThermalUnits = "MegabritishThermalUnit", /** */ GigabritishThermalUnits = "GigabritishThermalUnit", /** */ KiloelectronVolts = "KiloelectronVolt", /** */ MegaelectronVolts = "MegaelectronVolt", /** */ GigaelectronVolts = "GigaelectronVolt", /** */ TeraelectronVolts = "TeraelectronVolt", /** */ KilowattHours = "KilowattHour", /** */ MegawattHours = "MegawattHour", /** */ GigawattHours = "GigawattHour", /** */ TerawattHours = "TerawattHour", /** */ KilowattDays = "KilowattDay", /** */ MegawattDays = "MegawattDay", /** */ GigawattDays = "GigawattDay", /** */ TerawattDays = "TerawattDay", /** */ DecathermsEc = "DecathermEc", /** */ DecathermsUs = "DecathermUs", /** */ DecathermsImperial = "DecathermImperial" } /** The joule, symbol J, is a derived unit of energy, work, or amount of heat in the International System of Units. It is equal to the energy transferred (or work done) when applying a force of one newton through a distance of one metre (1 newton metre or N·m), or in passing an electric current of one ampere through a resistance of one ohm for one second. Many other units of energy are included. Please do not confuse this definition of the calorie with the one colloquially used by the food industry, the large calorie, which is equivalent to 1 kcal. Thermochemical definition of the calorie is used. For BTU, the IT definition is used. */ export declare class Energy extends BaseUnit { protected value: number; private joulesLazy; private caloriesLazy; private britishthermalunitsLazy; private electronvoltsLazy; private footpoundsLazy; private ergsLazy; private watthoursLazy; private wattdaysLazy; private thermsecLazy; private thermsusLazy; private thermsimperialLazy; private horsepowerhoursLazy; private nanojoulesLazy; private microjoulesLazy; private millijoulesLazy; private kilojoulesLazy; private megajoulesLazy; private gigajoulesLazy; private terajoulesLazy; private petajoulesLazy; private kilocaloriesLazy; private megacaloriesLazy; private kilobritishthermalunitsLazy; private megabritishthermalunitsLazy; private gigabritishthermalunitsLazy; private kiloelectronvoltsLazy; private megaelectronvoltsLazy; private gigaelectronvoltsLazy; private teraelectronvoltsLazy; private kilowatthoursLazy; private megawatthoursLazy; private gigawatthoursLazy; private terawatthoursLazy; private kilowattdaysLazy; private megawattdaysLazy; private gigawattdaysLazy; private terawattdaysLazy; private decathermsecLazy; private decathermsusLazy; private decathermsimperialLazy; /** * Create a new Energy. * @param value The value. * @param fromUnit The ‘Energy’ unit to create from. * The default unit is Joules */ constructor(value: number, fromUnit?: EnergyUnits); /** * The base value of Energy is Joules. * This accessor used when needs a value for calculations and it's better to use directly the base value */ get BaseValue(): number; /** Gets the default unit used when creating instances of the unit or its DTO */ protected get baseUnit(): EnergyUnits.Joules; /** */ get Joules(): number; /** */ get Calories(): number; /** */ get BritishThermalUnits(): number; /** In physics, an electronvolt (symbol eV, also written electron-volt and electron volt) is the measure of an amount of kinetic energy gained by a single electron accelerating from rest through an electric potential difference of one volt in vacuum. When used as a unit of energy, the numerical value of 1 eV in joules (symbol J) is equivalent to the numerical value of the charge of an electron in coulombs (symbol C). Under the 2019 redefinition of the SI base units, this sets 1 eV equal to the exact value 1.602176634×10−19 J. */ get ElectronVolts(): number; /** A pound-foot (lb⋅ft), abbreviated from pound-force foot (lbf · ft), is a unit of torque representing one pound of force acting at a perpendicular distance of one foot from a pivot point. Conversely one foot pound-force (ft · lbf) is the moment about an axis that applies one pound-force at a radius of one foot. */ get FootPounds(): number; /** The erg is a unit of energy equal to 10−7 joules (100 nJ). It originated in the Centimetre–gram–second system of units (CGS). It has the symbol erg. The erg is not an SI unit. Its name is derived from ergon (ἔργον), a Greek word meaning 'work' or 'task'. */ get Ergs(): number; /** */ get WattHours(): number; /** */ get WattDays(): number; /** The therm (symbol, thm) is a non-SI unit of heat energy equal to 100,000 British thermal units (BTU), and approximately 105 megajoules, 29.3 kilowatt-hours, 25,200 kilocalories and 25.2 thermies. One therm is the energy content of approximately 100 cubic feet (2.83 cubic metres) of natural gas at standard temperature and pressure. However, the BTU is not standardised worldwide, with slightly different values in the EU, UK, and United States, meaning that the energy content of the therm also varies by territory. */ get ThermsEc(): number; /** The therm (symbol, thm) is a non-SI unit of heat energy equal to 100,000 British thermal units (BTU), and approximately 105 megajoules, 29.3 kilowatt-hours, 25,200 kilocalories and 25.2 thermies. One therm is the energy content of approximately 100 cubic feet (2.83 cubic metres) of natural gas at standard temperature and pressure. However, the BTU is not standardised worldwide, with slightly different values in the EU, UK, and United States, meaning that the energy content of the therm also varies by territory. */ get ThermsUs(): number; /** The therm (symbol, thm) is a non-SI unit of heat energy equal to 100,000 British thermal units (BTU), and approximately 105 megajoules, 29.3 kilowatt-hours, 25,200 kilocalories and 25.2 thermies. One therm is the energy content of approximately 100 cubic feet (2.83 cubic metres) of natural gas at standard temperature and pressure. However, the BTU is not standardised worldwide, with slightly different values in the EU, UK, and United States, meaning that the energy content of the therm also varies by territory. */ get ThermsImperial(): number; /** A horsepower-hour (symbol: hp⋅h) is an outdated unit of energy, not used in the International System of Units. The unit represents an amount of work a horse is supposed capable of delivering during an hour (1 horsepower integrated over a time interval of an hour). */ get HorsepowerHours(): number; /** */ get Nanojoules(): number; /** */ get Microjoules(): number; /** */ get Millijoules(): number; /** */ get Kilojoules(): number; /** */ get Megajoules(): number; /** */ get Gigajoules(): number; /** */ get Terajoules(): number; /** */ get Petajoules(): number; /** */ get Kilocalories(): number; /** */ get Megacalories(): number; /** */ get KilobritishThermalUnits(): number; /** */ get MegabritishThermalUnits(): number; /** */ get GigabritishThermalUnits(): number; /** */ get KiloelectronVolts(): number; /** */ get MegaelectronVolts(): number; /** */ get GigaelectronVolts(): number; /** */ get TeraelectronVolts(): number; /** */ get KilowattHours(): number; /** */ get MegawattHours(): number; /** */ get GigawattHours(): number; /** */ get TerawattHours(): number; /** */ get KilowattDays(): number; /** */ get MegawattDays(): number; /** */ get GigawattDays(): number; /** */ get TerawattDays(): number; /** */ get DecathermsEc(): number; /** */ get DecathermsUs(): number; /** */ get DecathermsImperial(): number; /** * Create a new Energy instance from a Joules * * @param value The unit as Joules to create a new Energy from. * @returns The new Energy instance. */ static FromJoules(value: number): Energy; /** * Create a new Energy instance from a Calories * * @param value The unit as Calories to create a new Energy from. * @returns The new Energy instance. */ static FromCalories(value: number): Energy; /** * Create a new Energy instance from a BritishThermalUnits * * @param value The unit as BritishThermalUnits to create a new Energy from. * @returns The new Energy instance. */ static FromBritishThermalUnits(value: number): Energy; /** * Create a new Energy instance from a ElectronVolts * In physics, an electronvolt (symbol eV, also written electron-volt and electron volt) is the measure of an amount of kinetic energy gained by a single electron accelerating from rest through an electric potential difference of one volt in vacuum. When used as a unit of energy, the numerical value of 1 eV in joules (symbol J) is equivalent to the numerical value of the charge of an electron in coulombs (symbol C). Under the 2019 redefinition of the SI base units, this sets 1 eV equal to the exact value 1.602176634×10−19 J. * @param value The unit as ElectronVolts to create a new Energy from. * @returns The new Energy instance. */ static FromElectronVolts(value: number): Energy; /** * Create a new Energy instance from a FootPounds * A pound-foot (lb⋅ft), abbreviated from pound-force foot (lbf · ft), is a unit of torque representing one pound of force acting at a perpendicular distance of one foot from a pivot point. Conversely one foot pound-force (ft · lbf) is the moment about an axis that applies one pound-force at a radius of one foot. * @param value The unit as FootPounds to create a new Energy from. * @returns The new Energy instance. */ static FromFootPounds(value: number): Energy; /** * Create a new Energy instance from a Ergs * The erg is a unit of energy equal to 10−7 joules (100 nJ). It originated in the Centimetre–gram–second system of units (CGS). It has the symbol erg. The erg is not an SI unit. Its name is derived from ergon (ἔργον), a Greek word meaning 'work' or 'task'. * @param value The unit as Ergs to create a new Energy from. * @returns The new Energy instance. */ static FromErgs(value: number): Energy; /** * Create a new Energy instance from a WattHours * * @param value The unit as WattHours to create a new Energy from. * @returns The new Energy instance. */ static FromWattHours(value: number): Energy; /** * Create a new Energy instance from a WattDays * * @param value The unit as WattDays to create a new Energy from. * @returns The new Energy instance. */ static FromWattDays(value: number): Energy; /** * Create a new Energy instance from a ThermsEc * The therm (symbol, thm) is a non-SI unit of heat energy equal to 100,000 British thermal units (BTU), and approximately 105 megajoules, 29.3 kilowatt-hours, 25,200 kilocalories and 25.2 thermies. One therm is the energy content of approximately 100 cubic feet (2.83 cubic metres) of natural gas at standard temperature and pressure. However, the BTU is not standardised worldwide, with slightly different values in the EU, UK, and United States, meaning that the energy content of the therm also varies by territory. * @param value The unit as ThermsEc to create a new Energy from. * @returns The new Energy instance. */ static FromThermsEc(value: number): Energy; /** * Create a new Energy instance from a ThermsUs * The therm (symbol, thm) is a non-SI unit of heat energy equal to 100,000 British thermal units (BTU), and approximately 105 megajoules, 29.3 kilowatt-hours, 25,200 kilocalories and 25.2 thermies. One therm is the energy content of approximately 100 cubic feet (2.83 cubic metres) of natural gas at standard temperature and pressure. However, the BTU is not standardised worldwide, with slightly different values in the EU, UK, and United States, meaning that the energy content of the therm also varies by territory. * @param value The unit as ThermsUs to create a new Energy from. * @returns The new Energy instance. */ static FromThermsUs(value: number): Energy; /** * Create a new Energy instance from a ThermsImperial * The therm (symbol, thm) is a non-SI unit of heat energy equal to 100,000 British thermal units (BTU), and approximately 105 megajoules, 29.3 kilowatt-hours, 25,200 kilocalories and 25.2 thermies. One therm is the energy content of approximately 100 cubic feet (2.83 cubic metres) of natural gas at standard temperature and pressure. However, the BTU is not standardised worldwide, with slightly different values in the EU, UK, and United States, meaning that the energy content of the therm also varies by territory. * @param value The unit as ThermsImperial to create a new Energy from. * @returns The new Energy instance. */ static FromThermsImperial(value: number): Energy; /** * Create a new Energy instance from a HorsepowerHours * A horsepower-hour (symbol: hp⋅h) is an outdated unit of energy, not used in the International System of Units. The unit represents an amount of work a horse is supposed capable of delivering during an hour (1 horsepower integrated over a time interval of an hour). * @param value The unit as HorsepowerHours to create a new Energy from. * @returns The new Energy instance. */ static FromHorsepowerHours(value: number): Energy; /** * Create a new Energy instance from a Nanojoules * * @param value The unit as Nanojoules to create a new Energy from. * @returns The new Energy instance. */ static FromNanojoules(value: number): Energy; /** * Create a new Energy instance from a Microjoules * * @param value The unit as Microjoules to create a new Energy from. * @returns The new Energy instance. */ static FromMicrojoules(value: number): Energy; /** * Create a new Energy instance from a Millijoules * * @param value The unit as Millijoules to create a new Energy from. * @returns The new Energy instance. */ static FromMillijoules(value: number): Energy; /** * Create a new Energy instance from a Kilojoules * * @param value The unit as Kilojoules to create a new Energy from. * @returns The new Energy instance. */ static FromKilojoules(value: number): Energy; /** * Create a new Energy instance from a Megajoules * * @param value The unit as Megajoules to create a new Energy from. * @returns The new Energy instance. */ static FromMegajoules(value: number): Energy; /** * Create a new Energy instance from a Gigajoules * * @param value The unit as Gigajoules to create a new Energy from. * @returns The new Energy instance. */ static FromGigajoules(value: number): Energy; /** * Create a new Energy instance from a Terajoules * * @param value The unit as Terajoules to create a new Energy from. * @returns The new Energy instance. */ static FromTerajoules(value: number): Energy; /** * Create a new Energy instance from a Petajoules * * @param value The unit as Petajoules to create a new Energy from. * @returns The new Energy instance. */ static FromPetajoules(value: number): Energy; /** * Create a new Energy instance from a Kilocalories * * @param value The unit as Kilocalories to create a new Energy from. * @returns The new Energy instance. */ static FromKilocalories(value: number): Energy; /** * Create a new Energy instance from a Megacalories * * @param value The unit as Megacalories to create a new Energy from. * @returns The new Energy instance. */ static FromMegacalories(value: number): Energy; /** * Create a new Energy instance from a KilobritishThermalUnits * * @param value The unit as KilobritishThermalUnits to create a new Energy from. * @returns The new Energy instance. */ static FromKilobritishThermalUnits(value: number): Energy; /** * Create a new Energy instance from a MegabritishThermalUnits * * @param value The unit as MegabritishThermalUnits to create a new Energy from. * @returns The new Energy instance. */ static FromMegabritishThermalUnits(value: number): Energy; /** * Create a new Energy instance from a GigabritishThermalUnits * * @param value The unit as GigabritishThermalUnits to create a new Energy from. * @returns The new Energy instance. */ static FromGigabritishThermalUnits(value: number): Energy; /** * Create a new Energy instance from a KiloelectronVolts * * @param value The unit as KiloelectronVolts to create a new Energy from. * @returns The new Energy instance. */ static FromKiloelectronVolts(value: number): Energy; /** * Create a new Energy instance from a MegaelectronVolts * * @param value The unit as MegaelectronVolts to create a new Energy from. * @returns The new Energy instance. */ static FromMegaelectronVolts(value: number): Energy; /** * Create a new Energy instance from a GigaelectronVolts * * @param value The unit as GigaelectronVolts to create a new Energy from. * @returns The new Energy instance. */ static FromGigaelectronVolts(value: number): Energy; /** * Create a new Energy instance from a TeraelectronVolts * * @param value The unit as TeraelectronVolts to create a new Energy from. * @returns The new Energy instance. */ static FromTeraelectronVolts(value: number): Energy; /** * Create a new Energy instance from a KilowattHours * * @param value The unit as KilowattHours to create a new Energy from. * @returns The new Energy instance. */ static FromKilowattHours(value: number): Energy; /** * Create a new Energy instance from a MegawattHours * * @param value The unit as MegawattHours to create a new Energy from. * @returns The new Energy instance. */ static FromMegawattHours(value: number): Energy; /** * Create a new Energy instance from a GigawattHours * * @param value The unit as GigawattHours to create a new Energy from. * @returns The new Energy instance. */ static FromGigawattHours(value: number): Energy; /** * Create a new Energy instance from a TerawattHours * * @param value The unit as TerawattHours to create a new Energy from. * @returns The new Energy instance. */ static FromTerawattHours(value: number): Energy; /** * Create a new Energy instance from a KilowattDays * * @param value The unit as KilowattDays to create a new Energy from. * @returns The new Energy instance. */ static FromKilowattDays(value: number): Energy; /** * Create a new Energy instance from a MegawattDays * * @param value The unit as MegawattDays to create a new Energy from. * @returns The new Energy instance. */ static FromMegawattDays(value: number): Energy; /** * Create a new Energy instance from a GigawattDays * * @param value The unit as GigawattDays to create a new Energy from. * @returns The new Energy instance. */ static FromGigawattDays(value: number): Energy; /** * Create a new Energy instance from a TerawattDays * * @param value The unit as TerawattDays to create a new Energy from. * @returns The new Energy instance. */ static FromTerawattDays(value: number): Energy; /** * Create a new Energy instance from a DecathermsEc * * @param value The unit as DecathermsEc to create a new Energy from. * @returns The new Energy instance. */ static FromDecathermsEc(value: number): Energy; /** * Create a new Energy instance from a DecathermsUs * * @param value The unit as DecathermsUs to create a new Energy from. * @returns The new Energy instance. */ static FromDecathermsUs(value: number): Energy; /** * Create a new Energy instance from a DecathermsImperial * * @param value The unit as DecathermsImperial to create a new Energy from. * @returns The new Energy instance. */ static FromDecathermsImperial(value: number): Energy; /** * Gets the base unit enumeration associated with Energy * @returns The unit enumeration that can be used to interact with this type */ protected static getUnitEnum(): typeof EnergyUnits; /** * Gets the default unit used when creating instances of the unit or its DTO * @returns The unit enumeration value used as a default parameter in constructor and DTO methods */ protected static getBaseUnit(): EnergyUnits.Joules; /** * Create API DTO represent a Energy unit. * @param holdInUnit The specific Energy unit to be used in the unit representation at the DTO */ toDto(holdInUnit?: EnergyUnits): EnergyDto; /** * Create a Energy unit from an API DTO representation. * @param dtoEnergy The Energy API DTO representation */ static FromDto(dtoEnergy: EnergyDto): Energy; /** * Convert Energy to a specific unit value. * @param toUnit The specific unit to convert to * @returns The value of the specific unit provided. */ convert(toUnit: EnergyUnits): number; private convertFromBase; private convertToBase; /** * Format the Energy to string. * Note! the default format for Energy is Joules. * To specify the unit format set the 'unit' parameter. * @param unit The unit to format the Energy. * @param options The ToString options, it also can be the number of fractional digits to keep that deprecated and moved to the options object. support in number will be dropped in the upcoming versions. * @returns The string format of the Energy. */ toString(unit?: EnergyUnits, options?: number | ToStringOptions): string; /** * Get Energy unit abbreviation. * Note! the default abbreviation for Energy is Joules. * To specify the unit abbreviation set the 'unitAbbreviation' parameter. * @param unitAbbreviation The unit abbreviation of the Energy. * @returns The abbreviation string of Energy. */ getUnitAbbreviation(unitAbbreviation?: EnergyUnits): string; /** * Check if the given Energy are equals to the current Energy. * @param energy The other Energy. * @returns True if the given Energy are equal to the current Energy. */ equals(energy: Energy): boolean; /** * Compare the given Energy against the current Energy. * @param energy The other Energy. * @returns 0 if they are equal, -1 if the current Energy is less then other, 1 if the current Energy is greater then other. */ compareTo(energy: Energy): number; /** * Add the given Energy with the current Energy. * @param energy The other Energy. * @returns A new Energy instance with the results. */ add(energy: Energy): Energy; /** * Subtract the given Energy with the current Energy. * @param energy The other Energy. * @returns A new Energy instance with the results. */ subtract(energy: Energy): Energy; /** * Multiply the given Energy with the current Energy. * @param energy The other Energy. * @returns A new Energy instance with the results. */ multiply(energy: Energy): Energy; /** * Divide the given Energy with the current Energy. * @param energy The other Energy. * @returns A new Energy instance with the results. */ divide(energy: Energy): Energy; /** * Modulo the given Energy with the current Energy. * @param energy The other Energy. * @returns A new Energy instance with the results. */ modulo(energy: Energy): Energy; /** * Pow the given Energy with the current Energy. * @param energy The other Energy. * @returns A new Energy instance with the results. */ pow(energy: Energy): Energy; }