unitsnet-js
Version:
A better way to hold unit variables and easily convert to the destination unit
411 lines (410 loc) • 15.7 kB
TypeScript
import { BaseUnit, ToStringOptions } from "../base-unit";
/** API DTO represents a MassFraction */
export interface MassFractionDto {
/** The value of the MassFraction */
value: number;
/** The specific unit that the MassFraction value is representing */
unit: MassFractionUnits;
}
/** MassFractionUnits enumeration */
export declare enum MassFractionUnits {
/** */
DecimalFractions = "DecimalFraction",
/** */
GramsPerGram = "GramPerGram",
/** */
GramsPerKilogram = "GramPerKilogram",
/** */
Percent = "Percent",
/** */
PartsPerThousand = "PartPerThousand",
/** */
PartsPerMillion = "PartPerMillion",
/** */
PartsPerBillion = "PartPerBillion",
/** */
PartsPerTrillion = "PartPerTrillion",
/** */
NanogramsPerGram = "NanogramPerGram",
/** */
MicrogramsPerGram = "MicrogramPerGram",
/** */
MilligramsPerGram = "MilligramPerGram",
/** */
CentigramsPerGram = "CentigramPerGram",
/** */
DecigramsPerGram = "DecigramPerGram",
/** */
DecagramsPerGram = "DecagramPerGram",
/** */
HectogramsPerGram = "HectogramPerGram",
/** */
KilogramsPerGram = "KilogramPerGram",
/** */
NanogramsPerKilogram = "NanogramPerKilogram",
/** */
MicrogramsPerKilogram = "MicrogramPerKilogram",
/** */
MilligramsPerKilogram = "MilligramPerKilogram",
/** */
CentigramsPerKilogram = "CentigramPerKilogram",
/** */
DecigramsPerKilogram = "DecigramPerKilogram",
/** */
DecagramsPerKilogram = "DecagramPerKilogram",
/** */
HectogramsPerKilogram = "HectogramPerKilogram",
/** */
KilogramsPerKilogram = "KilogramPerKilogram"
}
/** The mass fraction is defined as the mass of a constituent divided by the total mass of the mixture. */
export declare class MassFraction extends BaseUnit {
protected value: number;
private decimalfractionsLazy;
private gramspergramLazy;
private gramsperkilogramLazy;
private percentLazy;
private partsperthousandLazy;
private partspermillionLazy;
private partsperbillionLazy;
private partspertrillionLazy;
private nanogramspergramLazy;
private microgramspergramLazy;
private milligramspergramLazy;
private centigramspergramLazy;
private decigramspergramLazy;
private decagramspergramLazy;
private hectogramspergramLazy;
private kilogramspergramLazy;
private nanogramsperkilogramLazy;
private microgramsperkilogramLazy;
private milligramsperkilogramLazy;
private centigramsperkilogramLazy;
private decigramsperkilogramLazy;
private decagramsperkilogramLazy;
private hectogramsperkilogramLazy;
private kilogramsperkilogramLazy;
/**
* Create a new MassFraction.
* @param value The value.
* @param fromUnit The ‘MassFraction’ unit to create from.
* The default unit is DecimalFractions
*/
constructor(value: number, fromUnit?: MassFractionUnits);
/**
* The base value of MassFraction is DecimalFractions.
* 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(): MassFractionUnits.DecimalFractions;
/** */
get DecimalFractions(): number;
/** */
get GramsPerGram(): number;
/** */
get GramsPerKilogram(): number;
/** */
get Percent(): number;
/** */
get PartsPerThousand(): number;
/** */
get PartsPerMillion(): number;
/** */
get PartsPerBillion(): number;
/** */
get PartsPerTrillion(): number;
/** */
get NanogramsPerGram(): number;
/** */
get MicrogramsPerGram(): number;
/** */
get MilligramsPerGram(): number;
/** */
get CentigramsPerGram(): number;
/** */
get DecigramsPerGram(): number;
/** */
get DecagramsPerGram(): number;
/** */
get HectogramsPerGram(): number;
/** */
get KilogramsPerGram(): number;
/** */
get NanogramsPerKilogram(): number;
/** */
get MicrogramsPerKilogram(): number;
/** */
get MilligramsPerKilogram(): number;
/** */
get CentigramsPerKilogram(): number;
/** */
get DecigramsPerKilogram(): number;
/** */
get DecagramsPerKilogram(): number;
/** */
get HectogramsPerKilogram(): number;
/** */
get KilogramsPerKilogram(): number;
/**
* Create a new MassFraction instance from a DecimalFractions
*
* @param value The unit as DecimalFractions to create a new MassFraction from.
* @returns The new MassFraction instance.
*/
static FromDecimalFractions(value: number): MassFraction;
/**
* Create a new MassFraction instance from a GramsPerGram
*
* @param value The unit as GramsPerGram to create a new MassFraction from.
* @returns The new MassFraction instance.
*/
static FromGramsPerGram(value: number): MassFraction;
/**
* Create a new MassFraction instance from a GramsPerKilogram
*
* @param value The unit as GramsPerKilogram to create a new MassFraction from.
* @returns The new MassFraction instance.
*/
static FromGramsPerKilogram(value: number): MassFraction;
/**
* Create a new MassFraction instance from a Percent
*
* @param value The unit as Percent to create a new MassFraction from.
* @returns The new MassFraction instance.
*/
static FromPercent(value: number): MassFraction;
/**
* Create a new MassFraction instance from a PartsPerThousand
*
* @param value The unit as PartsPerThousand to create a new MassFraction from.
* @returns The new MassFraction instance.
*/
static FromPartsPerThousand(value: number): MassFraction;
/**
* Create a new MassFraction instance from a PartsPerMillion
*
* @param value The unit as PartsPerMillion to create a new MassFraction from.
* @returns The new MassFraction instance.
*/
static FromPartsPerMillion(value: number): MassFraction;
/**
* Create a new MassFraction instance from a PartsPerBillion
*
* @param value The unit as PartsPerBillion to create a new MassFraction from.
* @returns The new MassFraction instance.
*/
static FromPartsPerBillion(value: number): MassFraction;
/**
* Create a new MassFraction instance from a PartsPerTrillion
*
* @param value The unit as PartsPerTrillion to create a new MassFraction from.
* @returns The new MassFraction instance.
*/
static FromPartsPerTrillion(value: number): MassFraction;
/**
* Create a new MassFraction instance from a NanogramsPerGram
*
* @param value The unit as NanogramsPerGram to create a new MassFraction from.
* @returns The new MassFraction instance.
*/
static FromNanogramsPerGram(value: number): MassFraction;
/**
* Create a new MassFraction instance from a MicrogramsPerGram
*
* @param value The unit as MicrogramsPerGram to create a new MassFraction from.
* @returns The new MassFraction instance.
*/
static FromMicrogramsPerGram(value: number): MassFraction;
/**
* Create a new MassFraction instance from a MilligramsPerGram
*
* @param value The unit as MilligramsPerGram to create a new MassFraction from.
* @returns The new MassFraction instance.
*/
static FromMilligramsPerGram(value: number): MassFraction;
/**
* Create a new MassFraction instance from a CentigramsPerGram
*
* @param value The unit as CentigramsPerGram to create a new MassFraction from.
* @returns The new MassFraction instance.
*/
static FromCentigramsPerGram(value: number): MassFraction;
/**
* Create a new MassFraction instance from a DecigramsPerGram
*
* @param value The unit as DecigramsPerGram to create a new MassFraction from.
* @returns The new MassFraction instance.
*/
static FromDecigramsPerGram(value: number): MassFraction;
/**
* Create a new MassFraction instance from a DecagramsPerGram
*
* @param value The unit as DecagramsPerGram to create a new MassFraction from.
* @returns The new MassFraction instance.
*/
static FromDecagramsPerGram(value: number): MassFraction;
/**
* Create a new MassFraction instance from a HectogramsPerGram
*
* @param value The unit as HectogramsPerGram to create a new MassFraction from.
* @returns The new MassFraction instance.
*/
static FromHectogramsPerGram(value: number): MassFraction;
/**
* Create a new MassFraction instance from a KilogramsPerGram
*
* @param value The unit as KilogramsPerGram to create a new MassFraction from.
* @returns The new MassFraction instance.
*/
static FromKilogramsPerGram(value: number): MassFraction;
/**
* Create a new MassFraction instance from a NanogramsPerKilogram
*
* @param value The unit as NanogramsPerKilogram to create a new MassFraction from.
* @returns The new MassFraction instance.
*/
static FromNanogramsPerKilogram(value: number): MassFraction;
/**
* Create a new MassFraction instance from a MicrogramsPerKilogram
*
* @param value The unit as MicrogramsPerKilogram to create a new MassFraction from.
* @returns The new MassFraction instance.
*/
static FromMicrogramsPerKilogram(value: number): MassFraction;
/**
* Create a new MassFraction instance from a MilligramsPerKilogram
*
* @param value The unit as MilligramsPerKilogram to create a new MassFraction from.
* @returns The new MassFraction instance.
*/
static FromMilligramsPerKilogram(value: number): MassFraction;
/**
* Create a new MassFraction instance from a CentigramsPerKilogram
*
* @param value The unit as CentigramsPerKilogram to create a new MassFraction from.
* @returns The new MassFraction instance.
*/
static FromCentigramsPerKilogram(value: number): MassFraction;
/**
* Create a new MassFraction instance from a DecigramsPerKilogram
*
* @param value The unit as DecigramsPerKilogram to create a new MassFraction from.
* @returns The new MassFraction instance.
*/
static FromDecigramsPerKilogram(value: number): MassFraction;
/**
* Create a new MassFraction instance from a DecagramsPerKilogram
*
* @param value The unit as DecagramsPerKilogram to create a new MassFraction from.
* @returns The new MassFraction instance.
*/
static FromDecagramsPerKilogram(value: number): MassFraction;
/**
* Create a new MassFraction instance from a HectogramsPerKilogram
*
* @param value The unit as HectogramsPerKilogram to create a new MassFraction from.
* @returns The new MassFraction instance.
*/
static FromHectogramsPerKilogram(value: number): MassFraction;
/**
* Create a new MassFraction instance from a KilogramsPerKilogram
*
* @param value The unit as KilogramsPerKilogram to create a new MassFraction from.
* @returns The new MassFraction instance.
*/
static FromKilogramsPerKilogram(value: number): MassFraction;
/**
* Gets the base unit enumeration associated with MassFraction
* @returns The unit enumeration that can be used to interact with this type
*/
protected static getUnitEnum(): typeof MassFractionUnits;
/**
* 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(): MassFractionUnits.DecimalFractions;
/**
* Create API DTO represent a MassFraction unit.
* @param holdInUnit The specific MassFraction unit to be used in the unit representation at the DTO
*/
toDto(holdInUnit?: MassFractionUnits): MassFractionDto;
/**
* Create a MassFraction unit from an API DTO representation.
* @param dtoMassFraction The MassFraction API DTO representation
*/
static FromDto(dtoMassFraction: MassFractionDto): MassFraction;
/**
* Convert MassFraction to a specific unit value.
* @param toUnit The specific unit to convert to
* @returns The value of the specific unit provided.
*/
convert(toUnit: MassFractionUnits): number;
private convertFromBase;
private convertToBase;
/**
* Format the MassFraction to string.
* Note! the default format for MassFraction is DecimalFractions.
* To specify the unit format set the 'unit' parameter.
* @param unit The unit to format the MassFraction.
* @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 MassFraction.
*/
toString(unit?: MassFractionUnits, options?: number | ToStringOptions): string;
/**
* Get MassFraction unit abbreviation.
* Note! the default abbreviation for MassFraction is DecimalFractions.
* To specify the unit abbreviation set the 'unitAbbreviation' parameter.
* @param unitAbbreviation The unit abbreviation of the MassFraction.
* @returns The abbreviation string of MassFraction.
*/
getUnitAbbreviation(unitAbbreviation?: MassFractionUnits): string;
/**
* Check if the given MassFraction are equals to the current MassFraction.
* @param massFraction The other MassFraction.
* @returns True if the given MassFraction are equal to the current MassFraction.
*/
equals(massFraction: MassFraction): boolean;
/**
* Compare the given MassFraction against the current MassFraction.
* @param massFraction The other MassFraction.
* @returns 0 if they are equal, -1 if the current MassFraction is less then other, 1 if the current MassFraction is greater then other.
*/
compareTo(massFraction: MassFraction): number;
/**
* Add the given MassFraction with the current MassFraction.
* @param massFraction The other MassFraction.
* @returns A new MassFraction instance with the results.
*/
add(massFraction: MassFraction): MassFraction;
/**
* Subtract the given MassFraction with the current MassFraction.
* @param massFraction The other MassFraction.
* @returns A new MassFraction instance with the results.
*/
subtract(massFraction: MassFraction): MassFraction;
/**
* Multiply the given MassFraction with the current MassFraction.
* @param massFraction The other MassFraction.
* @returns A new MassFraction instance with the results.
*/
multiply(massFraction: MassFraction): MassFraction;
/**
* Divide the given MassFraction with the current MassFraction.
* @param massFraction The other MassFraction.
* @returns A new MassFraction instance with the results.
*/
divide(massFraction: MassFraction): MassFraction;
/**
* Modulo the given MassFraction with the current MassFraction.
* @param massFraction The other MassFraction.
* @returns A new MassFraction instance with the results.
*/
modulo(massFraction: MassFraction): MassFraction;
/**
* Pow the given MassFraction with the current MassFraction.
* @param massFraction The other MassFraction.
* @returns A new MassFraction instance with the results.
*/
pow(massFraction: MassFraction): MassFraction;
}