UNPKG

unitsnet-js

Version:

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

327 lines (326 loc) 12.8 kB
import { BaseUnit, ToStringOptions } from "../base-unit"; /** API DTO represents a AmountOfSubstance */ export interface AmountOfSubstanceDto { /** The value of the AmountOfSubstance */ value: number; /** The specific unit that the AmountOfSubstance value is representing */ unit: AmountOfSubstanceUnits; } /** AmountOfSubstanceUnits enumeration */ export declare enum AmountOfSubstanceUnits { /** */ Moles = "Mole", /** */ PoundMoles = "PoundMole", /** */ Femtomoles = "Femtomole", /** */ Picomoles = "Picomole", /** */ Nanomoles = "Nanomole", /** */ Micromoles = "Micromole", /** */ Millimoles = "Millimole", /** */ Centimoles = "Centimole", /** */ Decimoles = "Decimole", /** */ Kilomoles = "Kilomole", /** */ Megamoles = "Megamole", /** */ NanopoundMoles = "NanopoundMole", /** */ MicropoundMoles = "MicropoundMole", /** */ MillipoundMoles = "MillipoundMole", /** */ CentipoundMoles = "CentipoundMole", /** */ DecipoundMoles = "DecipoundMole", /** */ KilopoundMoles = "KilopoundMole" } /** Mole is the amount of substance containing Avagadro's Number (6.02 x 10 ^ 23) of real particles such as molecules,atoms, ions or radicals. */ export declare class AmountOfSubstance extends BaseUnit { protected value: number; private molesLazy; private poundmolesLazy; private femtomolesLazy; private picomolesLazy; private nanomolesLazy; private micromolesLazy; private millimolesLazy; private centimolesLazy; private decimolesLazy; private kilomolesLazy; private megamolesLazy; private nanopoundmolesLazy; private micropoundmolesLazy; private millipoundmolesLazy; private centipoundmolesLazy; private decipoundmolesLazy; private kilopoundmolesLazy; /** * Create a new AmountOfSubstance. * @param value The value. * @param fromUnit The ‘AmountOfSubstance’ unit to create from. * The default unit is Moles */ constructor(value: number, fromUnit?: AmountOfSubstanceUnits); /** * The base value of AmountOfSubstance is Moles. * 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(): AmountOfSubstanceUnits.Moles; /** */ get Moles(): number; /** */ get PoundMoles(): number; /** */ get Femtomoles(): number; /** */ get Picomoles(): number; /** */ get Nanomoles(): number; /** */ get Micromoles(): number; /** */ get Millimoles(): number; /** */ get Centimoles(): number; /** */ get Decimoles(): number; /** */ get Kilomoles(): number; /** */ get Megamoles(): number; /** */ get NanopoundMoles(): number; /** */ get MicropoundMoles(): number; /** */ get MillipoundMoles(): number; /** */ get CentipoundMoles(): number; /** */ get DecipoundMoles(): number; /** */ get KilopoundMoles(): number; /** * Create a new AmountOfSubstance instance from a Moles * * @param value The unit as Moles to create a new AmountOfSubstance from. * @returns The new AmountOfSubstance instance. */ static FromMoles(value: number): AmountOfSubstance; /** * Create a new AmountOfSubstance instance from a PoundMoles * * @param value The unit as PoundMoles to create a new AmountOfSubstance from. * @returns The new AmountOfSubstance instance. */ static FromPoundMoles(value: number): AmountOfSubstance; /** * Create a new AmountOfSubstance instance from a Femtomoles * * @param value The unit as Femtomoles to create a new AmountOfSubstance from. * @returns The new AmountOfSubstance instance. */ static FromFemtomoles(value: number): AmountOfSubstance; /** * Create a new AmountOfSubstance instance from a Picomoles * * @param value The unit as Picomoles to create a new AmountOfSubstance from. * @returns The new AmountOfSubstance instance. */ static FromPicomoles(value: number): AmountOfSubstance; /** * Create a new AmountOfSubstance instance from a Nanomoles * * @param value The unit as Nanomoles to create a new AmountOfSubstance from. * @returns The new AmountOfSubstance instance. */ static FromNanomoles(value: number): AmountOfSubstance; /** * Create a new AmountOfSubstance instance from a Micromoles * * @param value The unit as Micromoles to create a new AmountOfSubstance from. * @returns The new AmountOfSubstance instance. */ static FromMicromoles(value: number): AmountOfSubstance; /** * Create a new AmountOfSubstance instance from a Millimoles * * @param value The unit as Millimoles to create a new AmountOfSubstance from. * @returns The new AmountOfSubstance instance. */ static FromMillimoles(value: number): AmountOfSubstance; /** * Create a new AmountOfSubstance instance from a Centimoles * * @param value The unit as Centimoles to create a new AmountOfSubstance from. * @returns The new AmountOfSubstance instance. */ static FromCentimoles(value: number): AmountOfSubstance; /** * Create a new AmountOfSubstance instance from a Decimoles * * @param value The unit as Decimoles to create a new AmountOfSubstance from. * @returns The new AmountOfSubstance instance. */ static FromDecimoles(value: number): AmountOfSubstance; /** * Create a new AmountOfSubstance instance from a Kilomoles * * @param value The unit as Kilomoles to create a new AmountOfSubstance from. * @returns The new AmountOfSubstance instance. */ static FromKilomoles(value: number): AmountOfSubstance; /** * Create a new AmountOfSubstance instance from a Megamoles * * @param value The unit as Megamoles to create a new AmountOfSubstance from. * @returns The new AmountOfSubstance instance. */ static FromMegamoles(value: number): AmountOfSubstance; /** * Create a new AmountOfSubstance instance from a NanopoundMoles * * @param value The unit as NanopoundMoles to create a new AmountOfSubstance from. * @returns The new AmountOfSubstance instance. */ static FromNanopoundMoles(value: number): AmountOfSubstance; /** * Create a new AmountOfSubstance instance from a MicropoundMoles * * @param value The unit as MicropoundMoles to create a new AmountOfSubstance from. * @returns The new AmountOfSubstance instance. */ static FromMicropoundMoles(value: number): AmountOfSubstance; /** * Create a new AmountOfSubstance instance from a MillipoundMoles * * @param value The unit as MillipoundMoles to create a new AmountOfSubstance from. * @returns The new AmountOfSubstance instance. */ static FromMillipoundMoles(value: number): AmountOfSubstance; /** * Create a new AmountOfSubstance instance from a CentipoundMoles * * @param value The unit as CentipoundMoles to create a new AmountOfSubstance from. * @returns The new AmountOfSubstance instance. */ static FromCentipoundMoles(value: number): AmountOfSubstance; /** * Create a new AmountOfSubstance instance from a DecipoundMoles * * @param value The unit as DecipoundMoles to create a new AmountOfSubstance from. * @returns The new AmountOfSubstance instance. */ static FromDecipoundMoles(value: number): AmountOfSubstance; /** * Create a new AmountOfSubstance instance from a KilopoundMoles * * @param value The unit as KilopoundMoles to create a new AmountOfSubstance from. * @returns The new AmountOfSubstance instance. */ static FromKilopoundMoles(value: number): AmountOfSubstance; /** * Gets the base unit enumeration associated with AmountOfSubstance * @returns The unit enumeration that can be used to interact with this type */ protected static getUnitEnum(): typeof AmountOfSubstanceUnits; /** * 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(): AmountOfSubstanceUnits.Moles; /** * Create API DTO represent a AmountOfSubstance unit. * @param holdInUnit The specific AmountOfSubstance unit to be used in the unit representation at the DTO */ toDto(holdInUnit?: AmountOfSubstanceUnits): AmountOfSubstanceDto; /** * Create a AmountOfSubstance unit from an API DTO representation. * @param dtoAmountOfSubstance The AmountOfSubstance API DTO representation */ static FromDto(dtoAmountOfSubstance: AmountOfSubstanceDto): AmountOfSubstance; /** * Convert AmountOfSubstance to a specific unit value. * @param toUnit The specific unit to convert to * @returns The value of the specific unit provided. */ convert(toUnit: AmountOfSubstanceUnits): number; private convertFromBase; private convertToBase; /** * Format the AmountOfSubstance to string. * Note! the default format for AmountOfSubstance is Moles. * To specify the unit format set the 'unit' parameter. * @param unit The unit to format the AmountOfSubstance. * @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 AmountOfSubstance. */ toString(unit?: AmountOfSubstanceUnits, options?: number | ToStringOptions): string; /** * Get AmountOfSubstance unit abbreviation. * Note! the default abbreviation for AmountOfSubstance is Moles. * To specify the unit abbreviation set the 'unitAbbreviation' parameter. * @param unitAbbreviation The unit abbreviation of the AmountOfSubstance. * @returns The abbreviation string of AmountOfSubstance. */ getUnitAbbreviation(unitAbbreviation?: AmountOfSubstanceUnits): string; /** * Check if the given AmountOfSubstance are equals to the current AmountOfSubstance. * @param amountOfSubstance The other AmountOfSubstance. * @returns True if the given AmountOfSubstance are equal to the current AmountOfSubstance. */ equals(amountOfSubstance: AmountOfSubstance): boolean; /** * Compare the given AmountOfSubstance against the current AmountOfSubstance. * @param amountOfSubstance The other AmountOfSubstance. * @returns 0 if they are equal, -1 if the current AmountOfSubstance is less then other, 1 if the current AmountOfSubstance is greater then other. */ compareTo(amountOfSubstance: AmountOfSubstance): number; /** * Add the given AmountOfSubstance with the current AmountOfSubstance. * @param amountOfSubstance The other AmountOfSubstance. * @returns A new AmountOfSubstance instance with the results. */ add(amountOfSubstance: AmountOfSubstance): AmountOfSubstance; /** * Subtract the given AmountOfSubstance with the current AmountOfSubstance. * @param amountOfSubstance The other AmountOfSubstance. * @returns A new AmountOfSubstance instance with the results. */ subtract(amountOfSubstance: AmountOfSubstance): AmountOfSubstance; /** * Multiply the given AmountOfSubstance with the current AmountOfSubstance. * @param amountOfSubstance The other AmountOfSubstance. * @returns A new AmountOfSubstance instance with the results. */ multiply(amountOfSubstance: AmountOfSubstance): AmountOfSubstance; /** * Divide the given AmountOfSubstance with the current AmountOfSubstance. * @param amountOfSubstance The other AmountOfSubstance. * @returns A new AmountOfSubstance instance with the results. */ divide(amountOfSubstance: AmountOfSubstance): AmountOfSubstance; /** * Modulo the given AmountOfSubstance with the current AmountOfSubstance. * @param amountOfSubstance The other AmountOfSubstance. * @returns A new AmountOfSubstance instance with the results. */ modulo(amountOfSubstance: AmountOfSubstance): AmountOfSubstance; /** * Pow the given AmountOfSubstance with the current AmountOfSubstance. * @param amountOfSubstance The other AmountOfSubstance. * @returns A new AmountOfSubstance instance with the results. */ pow(amountOfSubstance: AmountOfSubstance): AmountOfSubstance; }