unitsnet-js
Version:
A better way to hold unit variables and easily convert to the destination unit
147 lines (146 loc) • 6.08 kB
TypeScript
import { BaseUnit, ToStringOptions } from "../base-unit";
/** API DTO represents a PowerRatio */
export interface PowerRatioDto {
/** The value of the PowerRatio */
value: number;
/** The specific unit that the PowerRatio value is representing */
unit: PowerRatioUnits;
}
/** PowerRatioUnits enumeration */
export declare enum PowerRatioUnits {
/** */
DecibelWatts = "DecibelWatt",
/** */
DecibelMilliwatts = "DecibelMilliwatt"
}
/** The strength of a signal expressed in decibels (dB) relative to one watt. */
export declare class PowerRatio extends BaseUnit {
protected value: number;
private decibelwattsLazy;
private decibelmilliwattsLazy;
/**
* Create a new PowerRatio.
* @param value The value.
* @param fromUnit The ‘PowerRatio’ unit to create from.
* The default unit is DecibelWatts
*/
constructor(value: number, fromUnit?: PowerRatioUnits);
/**
* The base value of PowerRatio is DecibelWatts.
* 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(): PowerRatioUnits.DecibelWatts;
/** */
get DecibelWatts(): number;
/** */
get DecibelMilliwatts(): number;
/**
* Create a new PowerRatio instance from a DecibelWatts
*
* @param value The unit as DecibelWatts to create a new PowerRatio from.
* @returns The new PowerRatio instance.
*/
static FromDecibelWatts(value: number): PowerRatio;
/**
* Create a new PowerRatio instance from a DecibelMilliwatts
*
* @param value The unit as DecibelMilliwatts to create a new PowerRatio from.
* @returns The new PowerRatio instance.
*/
static FromDecibelMilliwatts(value: number): PowerRatio;
/**
* Gets the base unit enumeration associated with PowerRatio
* @returns The unit enumeration that can be used to interact with this type
*/
protected static getUnitEnum(): typeof PowerRatioUnits;
/**
* 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(): PowerRatioUnits.DecibelWatts;
/**
* Create API DTO represent a PowerRatio unit.
* @param holdInUnit The specific PowerRatio unit to be used in the unit representation at the DTO
*/
toDto(holdInUnit?: PowerRatioUnits): PowerRatioDto;
/**
* Create a PowerRatio unit from an API DTO representation.
* @param dtoPowerRatio The PowerRatio API DTO representation
*/
static FromDto(dtoPowerRatio: PowerRatioDto): PowerRatio;
/**
* Convert PowerRatio to a specific unit value.
* @param toUnit The specific unit to convert to
* @returns The value of the specific unit provided.
*/
convert(toUnit: PowerRatioUnits): number;
private convertFromBase;
private convertToBase;
/**
* Format the PowerRatio to string.
* Note! the default format for PowerRatio is DecibelWatts.
* To specify the unit format set the 'unit' parameter.
* @param unit The unit to format the PowerRatio.
* @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 PowerRatio.
*/
toString(unit?: PowerRatioUnits, options?: number | ToStringOptions): string;
/**
* Get PowerRatio unit abbreviation.
* Note! the default abbreviation for PowerRatio is DecibelWatts.
* To specify the unit abbreviation set the 'unitAbbreviation' parameter.
* @param unitAbbreviation The unit abbreviation of the PowerRatio.
* @returns The abbreviation string of PowerRatio.
*/
getUnitAbbreviation(unitAbbreviation?: PowerRatioUnits): string;
/**
* Check if the given PowerRatio are equals to the current PowerRatio.
* @param powerRatio The other PowerRatio.
* @returns True if the given PowerRatio are equal to the current PowerRatio.
*/
equals(powerRatio: PowerRatio): boolean;
/**
* Compare the given PowerRatio against the current PowerRatio.
* @param powerRatio The other PowerRatio.
* @returns 0 if they are equal, -1 if the current PowerRatio is less then other, 1 if the current PowerRatio is greater then other.
*/
compareTo(powerRatio: PowerRatio): number;
/**
* Add the given PowerRatio with the current PowerRatio.
* @param powerRatio The other PowerRatio.
* @returns A new PowerRatio instance with the results.
*/
add(powerRatio: PowerRatio): PowerRatio;
/**
* Subtract the given PowerRatio with the current PowerRatio.
* @param powerRatio The other PowerRatio.
* @returns A new PowerRatio instance with the results.
*/
subtract(powerRatio: PowerRatio): PowerRatio;
/**
* Multiply the given PowerRatio with the current PowerRatio.
* @param powerRatio The other PowerRatio.
* @returns A new PowerRatio instance with the results.
*/
multiply(powerRatio: PowerRatio): PowerRatio;
/**
* Divide the given PowerRatio with the current PowerRatio.
* @param powerRatio The other PowerRatio.
* @returns A new PowerRatio instance with the results.
*/
divide(powerRatio: PowerRatio): PowerRatio;
/**
* Modulo the given PowerRatio with the current PowerRatio.
* @param powerRatio The other PowerRatio.
* @returns A new PowerRatio instance with the results.
*/
modulo(powerRatio: PowerRatio): PowerRatio;
/**
* Pow the given PowerRatio with the current PowerRatio.
* @param powerRatio The other PowerRatio.
* @returns A new PowerRatio instance with the results.
*/
pow(powerRatio: PowerRatio): PowerRatio;
}