unitsnet-js
Version:
A better way to hold unit variables and easily convert to the destination unit
279 lines (278 loc) • 10.6 kB
TypeScript
import { BaseUnit, ToStringOptions } from "../base-unit";
/** API DTO represents a MolarMass */
export interface MolarMassDto {
/** The value of the MolarMass */
value: number;
/** The specific unit that the MolarMass value is representing */
unit: MolarMassUnits;
}
/** MolarMassUnits enumeration */
export declare enum MolarMassUnits {
/** */
GramsPerMole = "GramPerMole",
/** */
KilogramsPerKilomole = "KilogramPerKilomole",
/** */
PoundsPerMole = "PoundPerMole",
/** */
NanogramsPerMole = "NanogramPerMole",
/** */
MicrogramsPerMole = "MicrogramPerMole",
/** */
MilligramsPerMole = "MilligramPerMole",
/** */
CentigramsPerMole = "CentigramPerMole",
/** */
DecigramsPerMole = "DecigramPerMole",
/** */
DecagramsPerMole = "DecagramPerMole",
/** */
HectogramsPerMole = "HectogramPerMole",
/** */
KilogramsPerMole = "KilogramPerMole",
/** */
KilopoundsPerMole = "KilopoundPerMole",
/** */
MegapoundsPerMole = "MegapoundPerMole"
}
/** In chemistry, the molar mass M is a physical property defined as the mass of a given substance (chemical element or chemical compound) divided by the amount of substance. */
export declare class MolarMass extends BaseUnit {
protected value: number;
private gramspermoleLazy;
private kilogramsperkilomoleLazy;
private poundspermoleLazy;
private nanogramspermoleLazy;
private microgramspermoleLazy;
private milligramspermoleLazy;
private centigramspermoleLazy;
private decigramspermoleLazy;
private decagramspermoleLazy;
private hectogramspermoleLazy;
private kilogramspermoleLazy;
private kilopoundspermoleLazy;
private megapoundspermoleLazy;
/**
* Create a new MolarMass.
* @param value The value.
* @param fromUnit The ‘MolarMass’ unit to create from.
* The default unit is KilogramsPerMole
*/
constructor(value: number, fromUnit?: MolarMassUnits);
/**
* The base value of MolarMass is KilogramsPerMole.
* 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(): MolarMassUnits.KilogramsPerMole;
/** */
get GramsPerMole(): number;
/** */
get KilogramsPerKilomole(): number;
/** */
get PoundsPerMole(): number;
/** */
get NanogramsPerMole(): number;
/** */
get MicrogramsPerMole(): number;
/** */
get MilligramsPerMole(): number;
/** */
get CentigramsPerMole(): number;
/** */
get DecigramsPerMole(): number;
/** */
get DecagramsPerMole(): number;
/** */
get HectogramsPerMole(): number;
/** */
get KilogramsPerMole(): number;
/** */
get KilopoundsPerMole(): number;
/** */
get MegapoundsPerMole(): number;
/**
* Create a new MolarMass instance from a GramsPerMole
*
* @param value The unit as GramsPerMole to create a new MolarMass from.
* @returns The new MolarMass instance.
*/
static FromGramsPerMole(value: number): MolarMass;
/**
* Create a new MolarMass instance from a KilogramsPerKilomole
*
* @param value The unit as KilogramsPerKilomole to create a new MolarMass from.
* @returns The new MolarMass instance.
*/
static FromKilogramsPerKilomole(value: number): MolarMass;
/**
* Create a new MolarMass instance from a PoundsPerMole
*
* @param value The unit as PoundsPerMole to create a new MolarMass from.
* @returns The new MolarMass instance.
*/
static FromPoundsPerMole(value: number): MolarMass;
/**
* Create a new MolarMass instance from a NanogramsPerMole
*
* @param value The unit as NanogramsPerMole to create a new MolarMass from.
* @returns The new MolarMass instance.
*/
static FromNanogramsPerMole(value: number): MolarMass;
/**
* Create a new MolarMass instance from a MicrogramsPerMole
*
* @param value The unit as MicrogramsPerMole to create a new MolarMass from.
* @returns The new MolarMass instance.
*/
static FromMicrogramsPerMole(value: number): MolarMass;
/**
* Create a new MolarMass instance from a MilligramsPerMole
*
* @param value The unit as MilligramsPerMole to create a new MolarMass from.
* @returns The new MolarMass instance.
*/
static FromMilligramsPerMole(value: number): MolarMass;
/**
* Create a new MolarMass instance from a CentigramsPerMole
*
* @param value The unit as CentigramsPerMole to create a new MolarMass from.
* @returns The new MolarMass instance.
*/
static FromCentigramsPerMole(value: number): MolarMass;
/**
* Create a new MolarMass instance from a DecigramsPerMole
*
* @param value The unit as DecigramsPerMole to create a new MolarMass from.
* @returns The new MolarMass instance.
*/
static FromDecigramsPerMole(value: number): MolarMass;
/**
* Create a new MolarMass instance from a DecagramsPerMole
*
* @param value The unit as DecagramsPerMole to create a new MolarMass from.
* @returns The new MolarMass instance.
*/
static FromDecagramsPerMole(value: number): MolarMass;
/**
* Create a new MolarMass instance from a HectogramsPerMole
*
* @param value The unit as HectogramsPerMole to create a new MolarMass from.
* @returns The new MolarMass instance.
*/
static FromHectogramsPerMole(value: number): MolarMass;
/**
* Create a new MolarMass instance from a KilogramsPerMole
*
* @param value The unit as KilogramsPerMole to create a new MolarMass from.
* @returns The new MolarMass instance.
*/
static FromKilogramsPerMole(value: number): MolarMass;
/**
* Create a new MolarMass instance from a KilopoundsPerMole
*
* @param value The unit as KilopoundsPerMole to create a new MolarMass from.
* @returns The new MolarMass instance.
*/
static FromKilopoundsPerMole(value: number): MolarMass;
/**
* Create a new MolarMass instance from a MegapoundsPerMole
*
* @param value The unit as MegapoundsPerMole to create a new MolarMass from.
* @returns The new MolarMass instance.
*/
static FromMegapoundsPerMole(value: number): MolarMass;
/**
* Gets the base unit enumeration associated with MolarMass
* @returns The unit enumeration that can be used to interact with this type
*/
protected static getUnitEnum(): typeof MolarMassUnits;
/**
* 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(): MolarMassUnits.KilogramsPerMole;
/**
* Create API DTO represent a MolarMass unit.
* @param holdInUnit The specific MolarMass unit to be used in the unit representation at the DTO
*/
toDto(holdInUnit?: MolarMassUnits): MolarMassDto;
/**
* Create a MolarMass unit from an API DTO representation.
* @param dtoMolarMass The MolarMass API DTO representation
*/
static FromDto(dtoMolarMass: MolarMassDto): MolarMass;
/**
* Convert MolarMass to a specific unit value.
* @param toUnit The specific unit to convert to
* @returns The value of the specific unit provided.
*/
convert(toUnit: MolarMassUnits): number;
private convertFromBase;
private convertToBase;
/**
* Format the MolarMass to string.
* Note! the default format for MolarMass is KilogramsPerMole.
* To specify the unit format set the 'unit' parameter.
* @param unit The unit to format the MolarMass.
* @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 MolarMass.
*/
toString(unit?: MolarMassUnits, options?: number | ToStringOptions): string;
/**
* Get MolarMass unit abbreviation.
* Note! the default abbreviation for MolarMass is KilogramsPerMole.
* To specify the unit abbreviation set the 'unitAbbreviation' parameter.
* @param unitAbbreviation The unit abbreviation of the MolarMass.
* @returns The abbreviation string of MolarMass.
*/
getUnitAbbreviation(unitAbbreviation?: MolarMassUnits): string;
/**
* Check if the given MolarMass are equals to the current MolarMass.
* @param molarMass The other MolarMass.
* @returns True if the given MolarMass are equal to the current MolarMass.
*/
equals(molarMass: MolarMass): boolean;
/**
* Compare the given MolarMass against the current MolarMass.
* @param molarMass The other MolarMass.
* @returns 0 if they are equal, -1 if the current MolarMass is less then other, 1 if the current MolarMass is greater then other.
*/
compareTo(molarMass: MolarMass): number;
/**
* Add the given MolarMass with the current MolarMass.
* @param molarMass The other MolarMass.
* @returns A new MolarMass instance with the results.
*/
add(molarMass: MolarMass): MolarMass;
/**
* Subtract the given MolarMass with the current MolarMass.
* @param molarMass The other MolarMass.
* @returns A new MolarMass instance with the results.
*/
subtract(molarMass: MolarMass): MolarMass;
/**
* Multiply the given MolarMass with the current MolarMass.
* @param molarMass The other MolarMass.
* @returns A new MolarMass instance with the results.
*/
multiply(molarMass: MolarMass): MolarMass;
/**
* Divide the given MolarMass with the current MolarMass.
* @param molarMass The other MolarMass.
* @returns A new MolarMass instance with the results.
*/
divide(molarMass: MolarMass): MolarMass;
/**
* Modulo the given MolarMass with the current MolarMass.
* @param molarMass The other MolarMass.
* @returns A new MolarMass instance with the results.
*/
modulo(molarMass: MolarMass): MolarMass;
/**
* Pow the given MolarMass with the current MolarMass.
* @param molarMass The other MolarMass.
* @returns A new MolarMass instance with the results.
*/
pow(molarMass: MolarMass): MolarMass;
}