UNPKG

unitsnet-js

Version:

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

159 lines (158 loc) 6.34 kB
import { BaseUnit, ToStringOptions } from "../base-unit"; /** API DTO represents a Molality */ export interface MolalityDto { /** The value of the Molality */ value: number; /** The specific unit that the Molality value is representing */ unit: MolalityUnits; } /** MolalityUnits enumeration */ export declare enum MolalityUnits { /** */ MolesPerKilogram = "MolePerKilogram", /** */ MolesPerGram = "MolePerGram", /** */ MillimolesPerKilogram = "MillimolePerKilogram" } /** Molality is a measure of the amount of solute in a solution relative to a given mass of solvent. */ export declare class Molality extends BaseUnit { protected value: number; private molesperkilogramLazy; private molespergramLazy; private millimolesperkilogramLazy; /** * Create a new Molality. * @param value The value. * @param fromUnit The ‘Molality’ unit to create from. * The default unit is MolesPerKilogram */ constructor(value: number, fromUnit?: MolalityUnits); /** * The base value of Molality is MolesPerKilogram. * 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(): MolalityUnits.MolesPerKilogram; /** */ get MolesPerKilogram(): number; /** */ get MolesPerGram(): number; /** */ get MillimolesPerKilogram(): number; /** * Create a new Molality instance from a MolesPerKilogram * * @param value The unit as MolesPerKilogram to create a new Molality from. * @returns The new Molality instance. */ static FromMolesPerKilogram(value: number): Molality; /** * Create a new Molality instance from a MolesPerGram * * @param value The unit as MolesPerGram to create a new Molality from. * @returns The new Molality instance. */ static FromMolesPerGram(value: number): Molality; /** * Create a new Molality instance from a MillimolesPerKilogram * * @param value The unit as MillimolesPerKilogram to create a new Molality from. * @returns The new Molality instance. */ static FromMillimolesPerKilogram(value: number): Molality; /** * Gets the base unit enumeration associated with Molality * @returns The unit enumeration that can be used to interact with this type */ protected static getUnitEnum(): typeof MolalityUnits; /** * 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(): MolalityUnits.MolesPerKilogram; /** * Create API DTO represent a Molality unit. * @param holdInUnit The specific Molality unit to be used in the unit representation at the DTO */ toDto(holdInUnit?: MolalityUnits): MolalityDto; /** * Create a Molality unit from an API DTO representation. * @param dtoMolality The Molality API DTO representation */ static FromDto(dtoMolality: MolalityDto): Molality; /** * Convert Molality to a specific unit value. * @param toUnit The specific unit to convert to * @returns The value of the specific unit provided. */ convert(toUnit: MolalityUnits): number; private convertFromBase; private convertToBase; /** * Format the Molality to string. * Note! the default format for Molality is MolesPerKilogram. * To specify the unit format set the 'unit' parameter. * @param unit The unit to format the Molality. * @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 Molality. */ toString(unit?: MolalityUnits, options?: number | ToStringOptions): string; /** * Get Molality unit abbreviation. * Note! the default abbreviation for Molality is MolesPerKilogram. * To specify the unit abbreviation set the 'unitAbbreviation' parameter. * @param unitAbbreviation The unit abbreviation of the Molality. * @returns The abbreviation string of Molality. */ getUnitAbbreviation(unitAbbreviation?: MolalityUnits): string; /** * Check if the given Molality are equals to the current Molality. * @param molality The other Molality. * @returns True if the given Molality are equal to the current Molality. */ equals(molality: Molality): boolean; /** * Compare the given Molality against the current Molality. * @param molality The other Molality. * @returns 0 if they are equal, -1 if the current Molality is less then other, 1 if the current Molality is greater then other. */ compareTo(molality: Molality): number; /** * Add the given Molality with the current Molality. * @param molality The other Molality. * @returns A new Molality instance with the results. */ add(molality: Molality): Molality; /** * Subtract the given Molality with the current Molality. * @param molality The other Molality. * @returns A new Molality instance with the results. */ subtract(molality: Molality): Molality; /** * Multiply the given Molality with the current Molality. * @param molality The other Molality. * @returns A new Molality instance with the results. */ multiply(molality: Molality): Molality; /** * Divide the given Molality with the current Molality. * @param molality The other Molality. * @returns A new Molality instance with the results. */ divide(molality: Molality): Molality; /** * Modulo the given Molality with the current Molality. * @param molality The other Molality. * @returns A new Molality instance with the results. */ modulo(molality: Molality): Molality; /** * Pow the given Molality with the current Molality. * @param molality The other Molality. * @returns A new Molality instance with the results. */ pow(molality: Molality): Molality; }