UNPKG

unitsnet-js

Version:

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

135 lines (134 loc) 5.6 kB
import { BaseUnit, ToStringOptions } from "../base-unit"; /** API DTO represents a Turbidity */ export interface TurbidityDto { /** The value of the Turbidity */ value: number; /** The specific unit that the Turbidity value is representing */ unit: TurbidityUnits; } /** TurbidityUnits enumeration */ export declare enum TurbidityUnits { /** */ NTU = "NTU" } /** Turbidity is the cloudiness or haziness of a fluid caused by large numbers of individual particles that are generally invisible to the naked eye, similar to smoke in air. The measurement of turbidity is a key test of water quality. */ export declare class Turbidity extends BaseUnit { protected value: number; private ntuLazy; /** * Create a new Turbidity. * @param value The value. * @param fromUnit The ‘Turbidity’ unit to create from. * The default unit is NTU */ constructor(value: number, fromUnit?: TurbidityUnits); /** * The base value of Turbidity is NTU. * 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(): TurbidityUnits.NTU; /** */ get NTU(): number; /** * Create a new Turbidity instance from a NTU * * @param value The unit as NTU to create a new Turbidity from. * @returns The new Turbidity instance. */ static FromNTU(value: number): Turbidity; /** * Gets the base unit enumeration associated with Turbidity * @returns The unit enumeration that can be used to interact with this type */ protected static getUnitEnum(): typeof TurbidityUnits; /** * 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(): TurbidityUnits.NTU; /** * Create API DTO represent a Turbidity unit. * @param holdInUnit The specific Turbidity unit to be used in the unit representation at the DTO */ toDto(holdInUnit?: TurbidityUnits): TurbidityDto; /** * Create a Turbidity unit from an API DTO representation. * @param dtoTurbidity The Turbidity API DTO representation */ static FromDto(dtoTurbidity: TurbidityDto): Turbidity; /** * Convert Turbidity to a specific unit value. * @param toUnit The specific unit to convert to * @returns The value of the specific unit provided. */ convert(toUnit: TurbidityUnits): number; private convertFromBase; private convertToBase; /** * Format the Turbidity to string. * Note! the default format for Turbidity is NTU. * To specify the unit format set the 'unit' parameter. * @param unit The unit to format the Turbidity. * @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 Turbidity. */ toString(unit?: TurbidityUnits, options?: number | ToStringOptions): string; /** * Get Turbidity unit abbreviation. * Note! the default abbreviation for Turbidity is NTU. * To specify the unit abbreviation set the 'unitAbbreviation' parameter. * @param unitAbbreviation The unit abbreviation of the Turbidity. * @returns The abbreviation string of Turbidity. */ getUnitAbbreviation(unitAbbreviation?: TurbidityUnits): string; /** * Check if the given Turbidity are equals to the current Turbidity. * @param turbidity The other Turbidity. * @returns True if the given Turbidity are equal to the current Turbidity. */ equals(turbidity: Turbidity): boolean; /** * Compare the given Turbidity against the current Turbidity. * @param turbidity The other Turbidity. * @returns 0 if they are equal, -1 if the current Turbidity is less then other, 1 if the current Turbidity is greater then other. */ compareTo(turbidity: Turbidity): number; /** * Add the given Turbidity with the current Turbidity. * @param turbidity The other Turbidity. * @returns A new Turbidity instance with the results. */ add(turbidity: Turbidity): Turbidity; /** * Subtract the given Turbidity with the current Turbidity. * @param turbidity The other Turbidity. * @returns A new Turbidity instance with the results. */ subtract(turbidity: Turbidity): Turbidity; /** * Multiply the given Turbidity with the current Turbidity. * @param turbidity The other Turbidity. * @returns A new Turbidity instance with the results. */ multiply(turbidity: Turbidity): Turbidity; /** * Divide the given Turbidity with the current Turbidity. * @param turbidity The other Turbidity. * @returns A new Turbidity instance with the results. */ divide(turbidity: Turbidity): Turbidity; /** * Modulo the given Turbidity with the current Turbidity. * @param turbidity The other Turbidity. * @returns A new Turbidity instance with the results. */ modulo(turbidity: Turbidity): Turbidity; /** * Pow the given Turbidity with the current Turbidity. * @param turbidity The other Turbidity. * @returns A new Turbidity instance with the results. */ pow(turbidity: Turbidity): Turbidity; }