UNPKG

unitsnet-js

Version:

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

447 lines (446 loc) 15 kB
import { BaseUnit, ToStringOptions } from "../base-unit"; /** API DTO represents a Power */ export interface PowerDto { /** The value of the Power */ value: number; /** The specific unit that the Power value is representing */ unit: PowerUnits; } /** PowerUnits enumeration */ export declare enum PowerUnits { /** */ Watts = "Watt", /** */ MechanicalHorsepower = "MechanicalHorsepower", /** */ MetricHorsepower = "MetricHorsepower", /** */ ElectricalHorsepower = "ElectricalHorsepower", /** */ BoilerHorsepower = "BoilerHorsepower", /** */ HydraulicHorsepower = "HydraulicHorsepower", /** */ BritishThermalUnitsPerHour = "BritishThermalUnitPerHour", /** */ JoulesPerHour = "JoulePerHour", /** */ TonsOfRefrigeration = "TonOfRefrigeration", /** */ Femtowatts = "Femtowatt", /** */ Picowatts = "Picowatt", /** */ Nanowatts = "Nanowatt", /** */ Microwatts = "Microwatt", /** */ Milliwatts = "Milliwatt", /** */ Deciwatts = "Deciwatt", /** */ Decawatts = "Decawatt", /** */ Kilowatts = "Kilowatt", /** */ Megawatts = "Megawatt", /** */ Gigawatts = "Gigawatt", /** */ Terawatts = "Terawatt", /** */ Petawatts = "Petawatt", /** */ KilobritishThermalUnitsPerHour = "KilobritishThermalUnitPerHour", /** */ MegabritishThermalUnitsPerHour = "MegabritishThermalUnitPerHour", /** */ MillijoulesPerHour = "MillijoulePerHour", /** */ KilojoulesPerHour = "KilojoulePerHour", /** */ MegajoulesPerHour = "MegajoulePerHour", /** */ GigajoulesPerHour = "GigajoulePerHour" } /** In physics, power is the rate of doing work. It is equivalent to an amount of energy consumed per unit time. */ export declare class Power extends BaseUnit { protected value: number; private wattsLazy; private mechanicalhorsepowerLazy; private metrichorsepowerLazy; private electricalhorsepowerLazy; private boilerhorsepowerLazy; private hydraulichorsepowerLazy; private britishthermalunitsperhourLazy; private joulesperhourLazy; private tonsofrefrigerationLazy; private femtowattsLazy; private picowattsLazy; private nanowattsLazy; private microwattsLazy; private milliwattsLazy; private deciwattsLazy; private decawattsLazy; private kilowattsLazy; private megawattsLazy; private gigawattsLazy; private terawattsLazy; private petawattsLazy; private kilobritishthermalunitsperhourLazy; private megabritishthermalunitsperhourLazy; private millijoulesperhourLazy; private kilojoulesperhourLazy; private megajoulesperhourLazy; private gigajoulesperhourLazy; /** * Create a new Power. * @param value The value. * @param fromUnit The ‘Power’ unit to create from. * The default unit is Watts */ constructor(value: number, fromUnit?: PowerUnits); /** * The base value of Power is Watts. * 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(): PowerUnits.Watts; /** */ get Watts(): number; /** */ get MechanicalHorsepower(): number; /** */ get MetricHorsepower(): number; /** */ get ElectricalHorsepower(): number; /** */ get BoilerHorsepower(): number; /** */ get HydraulicHorsepower(): number; /** */ get BritishThermalUnitsPerHour(): number; /** */ get JoulesPerHour(): number; /** */ get TonsOfRefrigeration(): number; /** */ get Femtowatts(): number; /** */ get Picowatts(): number; /** */ get Nanowatts(): number; /** */ get Microwatts(): number; /** */ get Milliwatts(): number; /** */ get Deciwatts(): number; /** */ get Decawatts(): number; /** */ get Kilowatts(): number; /** */ get Megawatts(): number; /** */ get Gigawatts(): number; /** */ get Terawatts(): number; /** */ get Petawatts(): number; /** */ get KilobritishThermalUnitsPerHour(): number; /** */ get MegabritishThermalUnitsPerHour(): number; /** */ get MillijoulesPerHour(): number; /** */ get KilojoulesPerHour(): number; /** */ get MegajoulesPerHour(): number; /** */ get GigajoulesPerHour(): number; /** * Create a new Power instance from a Watts * * @param value The unit as Watts to create a new Power from. * @returns The new Power instance. */ static FromWatts(value: number): Power; /** * Create a new Power instance from a MechanicalHorsepower * * @param value The unit as MechanicalHorsepower to create a new Power from. * @returns The new Power instance. */ static FromMechanicalHorsepower(value: number): Power; /** * Create a new Power instance from a MetricHorsepower * * @param value The unit as MetricHorsepower to create a new Power from. * @returns The new Power instance. */ static FromMetricHorsepower(value: number): Power; /** * Create a new Power instance from a ElectricalHorsepower * * @param value The unit as ElectricalHorsepower to create a new Power from. * @returns The new Power instance. */ static FromElectricalHorsepower(value: number): Power; /** * Create a new Power instance from a BoilerHorsepower * * @param value The unit as BoilerHorsepower to create a new Power from. * @returns The new Power instance. */ static FromBoilerHorsepower(value: number): Power; /** * Create a new Power instance from a HydraulicHorsepower * * @param value The unit as HydraulicHorsepower to create a new Power from. * @returns The new Power instance. */ static FromHydraulicHorsepower(value: number): Power; /** * Create a new Power instance from a BritishThermalUnitsPerHour * * @param value The unit as BritishThermalUnitsPerHour to create a new Power from. * @returns The new Power instance. */ static FromBritishThermalUnitsPerHour(value: number): Power; /** * Create a new Power instance from a JoulesPerHour * * @param value The unit as JoulesPerHour to create a new Power from. * @returns The new Power instance. */ static FromJoulesPerHour(value: number): Power; /** * Create a new Power instance from a TonsOfRefrigeration * * @param value The unit as TonsOfRefrigeration to create a new Power from. * @returns The new Power instance. */ static FromTonsOfRefrigeration(value: number): Power; /** * Create a new Power instance from a Femtowatts * * @param value The unit as Femtowatts to create a new Power from. * @returns The new Power instance. */ static FromFemtowatts(value: number): Power; /** * Create a new Power instance from a Picowatts * * @param value The unit as Picowatts to create a new Power from. * @returns The new Power instance. */ static FromPicowatts(value: number): Power; /** * Create a new Power instance from a Nanowatts * * @param value The unit as Nanowatts to create a new Power from. * @returns The new Power instance. */ static FromNanowatts(value: number): Power; /** * Create a new Power instance from a Microwatts * * @param value The unit as Microwatts to create a new Power from. * @returns The new Power instance. */ static FromMicrowatts(value: number): Power; /** * Create a new Power instance from a Milliwatts * * @param value The unit as Milliwatts to create a new Power from. * @returns The new Power instance. */ static FromMilliwatts(value: number): Power; /** * Create a new Power instance from a Deciwatts * * @param value The unit as Deciwatts to create a new Power from. * @returns The new Power instance. */ static FromDeciwatts(value: number): Power; /** * Create a new Power instance from a Decawatts * * @param value The unit as Decawatts to create a new Power from. * @returns The new Power instance. */ static FromDecawatts(value: number): Power; /** * Create a new Power instance from a Kilowatts * * @param value The unit as Kilowatts to create a new Power from. * @returns The new Power instance. */ static FromKilowatts(value: number): Power; /** * Create a new Power instance from a Megawatts * * @param value The unit as Megawatts to create a new Power from. * @returns The new Power instance. */ static FromMegawatts(value: number): Power; /** * Create a new Power instance from a Gigawatts * * @param value The unit as Gigawatts to create a new Power from. * @returns The new Power instance. */ static FromGigawatts(value: number): Power; /** * Create a new Power instance from a Terawatts * * @param value The unit as Terawatts to create a new Power from. * @returns The new Power instance. */ static FromTerawatts(value: number): Power; /** * Create a new Power instance from a Petawatts * * @param value The unit as Petawatts to create a new Power from. * @returns The new Power instance. */ static FromPetawatts(value: number): Power; /** * Create a new Power instance from a KilobritishThermalUnitsPerHour * * @param value The unit as KilobritishThermalUnitsPerHour to create a new Power from. * @returns The new Power instance. */ static FromKilobritishThermalUnitsPerHour(value: number): Power; /** * Create a new Power instance from a MegabritishThermalUnitsPerHour * * @param value The unit as MegabritishThermalUnitsPerHour to create a new Power from. * @returns The new Power instance. */ static FromMegabritishThermalUnitsPerHour(value: number): Power; /** * Create a new Power instance from a MillijoulesPerHour * * @param value The unit as MillijoulesPerHour to create a new Power from. * @returns The new Power instance. */ static FromMillijoulesPerHour(value: number): Power; /** * Create a new Power instance from a KilojoulesPerHour * * @param value The unit as KilojoulesPerHour to create a new Power from. * @returns The new Power instance. */ static FromKilojoulesPerHour(value: number): Power; /** * Create a new Power instance from a MegajoulesPerHour * * @param value The unit as MegajoulesPerHour to create a new Power from. * @returns The new Power instance. */ static FromMegajoulesPerHour(value: number): Power; /** * Create a new Power instance from a GigajoulesPerHour * * @param value The unit as GigajoulesPerHour to create a new Power from. * @returns The new Power instance. */ static FromGigajoulesPerHour(value: number): Power; /** * Gets the base unit enumeration associated with Power * @returns The unit enumeration that can be used to interact with this type */ protected static getUnitEnum(): typeof PowerUnits; /** * 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(): PowerUnits.Watts; /** * Create API DTO represent a Power unit. * @param holdInUnit The specific Power unit to be used in the unit representation at the DTO */ toDto(holdInUnit?: PowerUnits): PowerDto; /** * Create a Power unit from an API DTO representation. * @param dtoPower The Power API DTO representation */ static FromDto(dtoPower: PowerDto): Power; /** * Convert Power to a specific unit value. * @param toUnit The specific unit to convert to * @returns The value of the specific unit provided. */ convert(toUnit: PowerUnits): number; private convertFromBase; private convertToBase; /** * Format the Power to string. * Note! the default format for Power is Watts. * To specify the unit format set the 'unit' parameter. * @param unit The unit to format the Power. * @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 Power. */ toString(unit?: PowerUnits, options?: number | ToStringOptions): string; /** * Get Power unit abbreviation. * Note! the default abbreviation for Power is Watts. * To specify the unit abbreviation set the 'unitAbbreviation' parameter. * @param unitAbbreviation The unit abbreviation of the Power. * @returns The abbreviation string of Power. */ getUnitAbbreviation(unitAbbreviation?: PowerUnits): string; /** * Check if the given Power are equals to the current Power. * @param power The other Power. * @returns True if the given Power are equal to the current Power. */ equals(power: Power): boolean; /** * Compare the given Power against the current Power. * @param power The other Power. * @returns 0 if they are equal, -1 if the current Power is less then other, 1 if the current Power is greater then other. */ compareTo(power: Power): number; /** * Add the given Power with the current Power. * @param power The other Power. * @returns A new Power instance with the results. */ add(power: Power): Power; /** * Subtract the given Power with the current Power. * @param power The other Power. * @returns A new Power instance with the results. */ subtract(power: Power): Power; /** * Multiply the given Power with the current Power. * @param power The other Power. * @returns A new Power instance with the results. */ multiply(power: Power): Power; /** * Divide the given Power with the current Power. * @param power The other Power. * @returns A new Power instance with the results. */ divide(power: Power): Power; /** * Modulo the given Power with the current Power. * @param power The other Power. * @returns A new Power instance with the results. */ modulo(power: Power): Power; /** * Pow the given Power with the current Power. * @param power The other Power. * @returns A new Power instance with the results. */ pow(power: Power): Power; }