UNPKG

unitsnet-js

Version:

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

195 lines (194 loc) 8.49 kB
import { BaseUnit, ToStringOptions } from "../base-unit"; /** API DTO represents a ElectricPotential */ export interface ElectricPotentialDto { /** The value of the ElectricPotential */ value: number; /** The specific unit that the ElectricPotential value is representing */ unit: ElectricPotentialUnits; } /** ElectricPotentialUnits enumeration */ export declare enum ElectricPotentialUnits { /** */ Volts = "Volt", /** */ Nanovolts = "Nanovolt", /** */ Microvolts = "Microvolt", /** */ Millivolts = "Millivolt", /** */ Kilovolts = "Kilovolt", /** */ Megavolts = "Megavolt" } /** In classical electromagnetism, the electric potential (a scalar quantity denoted by Φ, ΦE or V and also called the electric field potential or the electrostatic potential) at a point is the amount of electric potential energy that a unitary point charge would have when located at that point. */ export declare class ElectricPotential extends BaseUnit { protected value: number; private voltsLazy; private nanovoltsLazy; private microvoltsLazy; private millivoltsLazy; private kilovoltsLazy; private megavoltsLazy; /** * Create a new ElectricPotential. * @param value The value. * @param fromUnit The ‘ElectricPotential’ unit to create from. * The default unit is Volts */ constructor(value: number, fromUnit?: ElectricPotentialUnits); /** * The base value of ElectricPotential is Volts. * 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(): ElectricPotentialUnits.Volts; /** */ get Volts(): number; /** */ get Nanovolts(): number; /** */ get Microvolts(): number; /** */ get Millivolts(): number; /** */ get Kilovolts(): number; /** */ get Megavolts(): number; /** * Create a new ElectricPotential instance from a Volts * * @param value The unit as Volts to create a new ElectricPotential from. * @returns The new ElectricPotential instance. */ static FromVolts(value: number): ElectricPotential; /** * Create a new ElectricPotential instance from a Nanovolts * * @param value The unit as Nanovolts to create a new ElectricPotential from. * @returns The new ElectricPotential instance. */ static FromNanovolts(value: number): ElectricPotential; /** * Create a new ElectricPotential instance from a Microvolts * * @param value The unit as Microvolts to create a new ElectricPotential from. * @returns The new ElectricPotential instance. */ static FromMicrovolts(value: number): ElectricPotential; /** * Create a new ElectricPotential instance from a Millivolts * * @param value The unit as Millivolts to create a new ElectricPotential from. * @returns The new ElectricPotential instance. */ static FromMillivolts(value: number): ElectricPotential; /** * Create a new ElectricPotential instance from a Kilovolts * * @param value The unit as Kilovolts to create a new ElectricPotential from. * @returns The new ElectricPotential instance. */ static FromKilovolts(value: number): ElectricPotential; /** * Create a new ElectricPotential instance from a Megavolts * * @param value The unit as Megavolts to create a new ElectricPotential from. * @returns The new ElectricPotential instance. */ static FromMegavolts(value: number): ElectricPotential; /** * Gets the base unit enumeration associated with ElectricPotential * @returns The unit enumeration that can be used to interact with this type */ protected static getUnitEnum(): typeof ElectricPotentialUnits; /** * 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(): ElectricPotentialUnits.Volts; /** * Create API DTO represent a ElectricPotential unit. * @param holdInUnit The specific ElectricPotential unit to be used in the unit representation at the DTO */ toDto(holdInUnit?: ElectricPotentialUnits): ElectricPotentialDto; /** * Create a ElectricPotential unit from an API DTO representation. * @param dtoElectricPotential The ElectricPotential API DTO representation */ static FromDto(dtoElectricPotential: ElectricPotentialDto): ElectricPotential; /** * Convert ElectricPotential to a specific unit value. * @param toUnit The specific unit to convert to * @returns The value of the specific unit provided. */ convert(toUnit: ElectricPotentialUnits): number; private convertFromBase; private convertToBase; /** * Format the ElectricPotential to string. * Note! the default format for ElectricPotential is Volts. * To specify the unit format set the 'unit' parameter. * @param unit The unit to format the ElectricPotential. * @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 ElectricPotential. */ toString(unit?: ElectricPotentialUnits, options?: number | ToStringOptions): string; /** * Get ElectricPotential unit abbreviation. * Note! the default abbreviation for ElectricPotential is Volts. * To specify the unit abbreviation set the 'unitAbbreviation' parameter. * @param unitAbbreviation The unit abbreviation of the ElectricPotential. * @returns The abbreviation string of ElectricPotential. */ getUnitAbbreviation(unitAbbreviation?: ElectricPotentialUnits): string; /** * Check if the given ElectricPotential are equals to the current ElectricPotential. * @param electricPotential The other ElectricPotential. * @returns True if the given ElectricPotential are equal to the current ElectricPotential. */ equals(electricPotential: ElectricPotential): boolean; /** * Compare the given ElectricPotential against the current ElectricPotential. * @param electricPotential The other ElectricPotential. * @returns 0 if they are equal, -1 if the current ElectricPotential is less then other, 1 if the current ElectricPotential is greater then other. */ compareTo(electricPotential: ElectricPotential): number; /** * Add the given ElectricPotential with the current ElectricPotential. * @param electricPotential The other ElectricPotential. * @returns A new ElectricPotential instance with the results. */ add(electricPotential: ElectricPotential): ElectricPotential; /** * Subtract the given ElectricPotential with the current ElectricPotential. * @param electricPotential The other ElectricPotential. * @returns A new ElectricPotential instance with the results. */ subtract(electricPotential: ElectricPotential): ElectricPotential; /** * Multiply the given ElectricPotential with the current ElectricPotential. * @param electricPotential The other ElectricPotential. * @returns A new ElectricPotential instance with the results. */ multiply(electricPotential: ElectricPotential): ElectricPotential; /** * Divide the given ElectricPotential with the current ElectricPotential. * @param electricPotential The other ElectricPotential. * @returns A new ElectricPotential instance with the results. */ divide(electricPotential: ElectricPotential): ElectricPotential; /** * Modulo the given ElectricPotential with the current ElectricPotential. * @param electricPotential The other ElectricPotential. * @returns A new ElectricPotential instance with the results. */ modulo(electricPotential: ElectricPotential): ElectricPotential; /** * Pow the given ElectricPotential with the current ElectricPotential. * @param electricPotential The other ElectricPotential. * @returns A new ElectricPotential instance with the results. */ pow(electricPotential: ElectricPotential): ElectricPotential; }