unitsnet-js
Version:
A better way to hold unit variables and easily convert to the destination unit
159 lines (158 loc) • 6.62 kB
TypeScript
import { BaseUnit, ToStringOptions } from "../base-unit";
/** API DTO represents a MolarEnergy */
export interface MolarEnergyDto {
/** The value of the MolarEnergy */
value: number;
/** The specific unit that the MolarEnergy value is representing */
unit: MolarEnergyUnits;
}
/** MolarEnergyUnits enumeration */
export declare enum MolarEnergyUnits {
/** */
JoulesPerMole = "JoulePerMole",
/** */
KilojoulesPerMole = "KilojoulePerMole",
/** */
MegajoulesPerMole = "MegajoulePerMole"
}
/** Molar energy is the amount of energy stored in 1 mole of a substance. */
export declare class MolarEnergy extends BaseUnit {
protected value: number;
private joulespermoleLazy;
private kilojoulespermoleLazy;
private megajoulespermoleLazy;
/**
* Create a new MolarEnergy.
* @param value The value.
* @param fromUnit The ‘MolarEnergy’ unit to create from.
* The default unit is JoulesPerMole
*/
constructor(value: number, fromUnit?: MolarEnergyUnits);
/**
* The base value of MolarEnergy is JoulesPerMole.
* 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(): MolarEnergyUnits.JoulesPerMole;
/** */
get JoulesPerMole(): number;
/** */
get KilojoulesPerMole(): number;
/** */
get MegajoulesPerMole(): number;
/**
* Create a new MolarEnergy instance from a JoulesPerMole
*
* @param value The unit as JoulesPerMole to create a new MolarEnergy from.
* @returns The new MolarEnergy instance.
*/
static FromJoulesPerMole(value: number): MolarEnergy;
/**
* Create a new MolarEnergy instance from a KilojoulesPerMole
*
* @param value The unit as KilojoulesPerMole to create a new MolarEnergy from.
* @returns The new MolarEnergy instance.
*/
static FromKilojoulesPerMole(value: number): MolarEnergy;
/**
* Create a new MolarEnergy instance from a MegajoulesPerMole
*
* @param value The unit as MegajoulesPerMole to create a new MolarEnergy from.
* @returns The new MolarEnergy instance.
*/
static FromMegajoulesPerMole(value: number): MolarEnergy;
/**
* Gets the base unit enumeration associated with MolarEnergy
* @returns The unit enumeration that can be used to interact with this type
*/
protected static getUnitEnum(): typeof MolarEnergyUnits;
/**
* 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(): MolarEnergyUnits.JoulesPerMole;
/**
* Create API DTO represent a MolarEnergy unit.
* @param holdInUnit The specific MolarEnergy unit to be used in the unit representation at the DTO
*/
toDto(holdInUnit?: MolarEnergyUnits): MolarEnergyDto;
/**
* Create a MolarEnergy unit from an API DTO representation.
* @param dtoMolarEnergy The MolarEnergy API DTO representation
*/
static FromDto(dtoMolarEnergy: MolarEnergyDto): MolarEnergy;
/**
* Convert MolarEnergy to a specific unit value.
* @param toUnit The specific unit to convert to
* @returns The value of the specific unit provided.
*/
convert(toUnit: MolarEnergyUnits): number;
private convertFromBase;
private convertToBase;
/**
* Format the MolarEnergy to string.
* Note! the default format for MolarEnergy is JoulesPerMole.
* To specify the unit format set the 'unit' parameter.
* @param unit The unit to format the MolarEnergy.
* @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 MolarEnergy.
*/
toString(unit?: MolarEnergyUnits, options?: number | ToStringOptions): string;
/**
* Get MolarEnergy unit abbreviation.
* Note! the default abbreviation for MolarEnergy is JoulesPerMole.
* To specify the unit abbreviation set the 'unitAbbreviation' parameter.
* @param unitAbbreviation The unit abbreviation of the MolarEnergy.
* @returns The abbreviation string of MolarEnergy.
*/
getUnitAbbreviation(unitAbbreviation?: MolarEnergyUnits): string;
/**
* Check if the given MolarEnergy are equals to the current MolarEnergy.
* @param molarEnergy The other MolarEnergy.
* @returns True if the given MolarEnergy are equal to the current MolarEnergy.
*/
equals(molarEnergy: MolarEnergy): boolean;
/**
* Compare the given MolarEnergy against the current MolarEnergy.
* @param molarEnergy The other MolarEnergy.
* @returns 0 if they are equal, -1 if the current MolarEnergy is less then other, 1 if the current MolarEnergy is greater then other.
*/
compareTo(molarEnergy: MolarEnergy): number;
/**
* Add the given MolarEnergy with the current MolarEnergy.
* @param molarEnergy The other MolarEnergy.
* @returns A new MolarEnergy instance with the results.
*/
add(molarEnergy: MolarEnergy): MolarEnergy;
/**
* Subtract the given MolarEnergy with the current MolarEnergy.
* @param molarEnergy The other MolarEnergy.
* @returns A new MolarEnergy instance with the results.
*/
subtract(molarEnergy: MolarEnergy): MolarEnergy;
/**
* Multiply the given MolarEnergy with the current MolarEnergy.
* @param molarEnergy The other MolarEnergy.
* @returns A new MolarEnergy instance with the results.
*/
multiply(molarEnergy: MolarEnergy): MolarEnergy;
/**
* Divide the given MolarEnergy with the current MolarEnergy.
* @param molarEnergy The other MolarEnergy.
* @returns A new MolarEnergy instance with the results.
*/
divide(molarEnergy: MolarEnergy): MolarEnergy;
/**
* Modulo the given MolarEnergy with the current MolarEnergy.
* @param molarEnergy The other MolarEnergy.
* @returns A new MolarEnergy instance with the results.
*/
modulo(molarEnergy: MolarEnergy): MolarEnergy;
/**
* Pow the given MolarEnergy with the current MolarEnergy.
* @param molarEnergy The other MolarEnergy.
* @returns A new MolarEnergy instance with the results.
*/
pow(molarEnergy: MolarEnergy): MolarEnergy;
}