unitsnet-js
Version:
A better way to hold unit variables and easily convert to the destination unit
207 lines (206 loc) • 7.92 kB
TypeScript
import { BaseUnit, ToStringOptions } from "../base-unit";
/** API DTO represents a Capacitance */
export interface CapacitanceDto {
/** The value of the Capacitance */
value: number;
/** The specific unit that the Capacitance value is representing */
unit: CapacitanceUnits;
}
/** CapacitanceUnits enumeration */
export declare enum CapacitanceUnits {
/** */
Farads = "Farad",
/** */
Picofarads = "Picofarad",
/** */
Nanofarads = "Nanofarad",
/** */
Microfarads = "Microfarad",
/** */
Millifarads = "Millifarad",
/** */
Kilofarads = "Kilofarad",
/** */
Megafarads = "Megafarad"
}
/** Capacitance is the ability of a body to store an electric charge. */
export declare class Capacitance extends BaseUnit {
protected value: number;
private faradsLazy;
private picofaradsLazy;
private nanofaradsLazy;
private microfaradsLazy;
private millifaradsLazy;
private kilofaradsLazy;
private megafaradsLazy;
/**
* Create a new Capacitance.
* @param value The value.
* @param fromUnit The ‘Capacitance’ unit to create from.
* The default unit is Farads
*/
constructor(value: number, fromUnit?: CapacitanceUnits);
/**
* The base value of Capacitance is Farads.
* 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(): CapacitanceUnits.Farads;
/** */
get Farads(): number;
/** */
get Picofarads(): number;
/** */
get Nanofarads(): number;
/** */
get Microfarads(): number;
/** */
get Millifarads(): number;
/** */
get Kilofarads(): number;
/** */
get Megafarads(): number;
/**
* Create a new Capacitance instance from a Farads
*
* @param value The unit as Farads to create a new Capacitance from.
* @returns The new Capacitance instance.
*/
static FromFarads(value: number): Capacitance;
/**
* Create a new Capacitance instance from a Picofarads
*
* @param value The unit as Picofarads to create a new Capacitance from.
* @returns The new Capacitance instance.
*/
static FromPicofarads(value: number): Capacitance;
/**
* Create a new Capacitance instance from a Nanofarads
*
* @param value The unit as Nanofarads to create a new Capacitance from.
* @returns The new Capacitance instance.
*/
static FromNanofarads(value: number): Capacitance;
/**
* Create a new Capacitance instance from a Microfarads
*
* @param value The unit as Microfarads to create a new Capacitance from.
* @returns The new Capacitance instance.
*/
static FromMicrofarads(value: number): Capacitance;
/**
* Create a new Capacitance instance from a Millifarads
*
* @param value The unit as Millifarads to create a new Capacitance from.
* @returns The new Capacitance instance.
*/
static FromMillifarads(value: number): Capacitance;
/**
* Create a new Capacitance instance from a Kilofarads
*
* @param value The unit as Kilofarads to create a new Capacitance from.
* @returns The new Capacitance instance.
*/
static FromKilofarads(value: number): Capacitance;
/**
* Create a new Capacitance instance from a Megafarads
*
* @param value The unit as Megafarads to create a new Capacitance from.
* @returns The new Capacitance instance.
*/
static FromMegafarads(value: number): Capacitance;
/**
* Gets the base unit enumeration associated with Capacitance
* @returns The unit enumeration that can be used to interact with this type
*/
protected static getUnitEnum(): typeof CapacitanceUnits;
/**
* 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(): CapacitanceUnits.Farads;
/**
* Create API DTO represent a Capacitance unit.
* @param holdInUnit The specific Capacitance unit to be used in the unit representation at the DTO
*/
toDto(holdInUnit?: CapacitanceUnits): CapacitanceDto;
/**
* Create a Capacitance unit from an API DTO representation.
* @param dtoCapacitance The Capacitance API DTO representation
*/
static FromDto(dtoCapacitance: CapacitanceDto): Capacitance;
/**
* Convert Capacitance to a specific unit value.
* @param toUnit The specific unit to convert to
* @returns The value of the specific unit provided.
*/
convert(toUnit: CapacitanceUnits): number;
private convertFromBase;
private convertToBase;
/**
* Format the Capacitance to string.
* Note! the default format for Capacitance is Farads.
* To specify the unit format set the 'unit' parameter.
* @param unit The unit to format the Capacitance.
* @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 Capacitance.
*/
toString(unit?: CapacitanceUnits, options?: number | ToStringOptions): string;
/**
* Get Capacitance unit abbreviation.
* Note! the default abbreviation for Capacitance is Farads.
* To specify the unit abbreviation set the 'unitAbbreviation' parameter.
* @param unitAbbreviation The unit abbreviation of the Capacitance.
* @returns The abbreviation string of Capacitance.
*/
getUnitAbbreviation(unitAbbreviation?: CapacitanceUnits): string;
/**
* Check if the given Capacitance are equals to the current Capacitance.
* @param capacitance The other Capacitance.
* @returns True if the given Capacitance are equal to the current Capacitance.
*/
equals(capacitance: Capacitance): boolean;
/**
* Compare the given Capacitance against the current Capacitance.
* @param capacitance The other Capacitance.
* @returns 0 if they are equal, -1 if the current Capacitance is less then other, 1 if the current Capacitance is greater then other.
*/
compareTo(capacitance: Capacitance): number;
/**
* Add the given Capacitance with the current Capacitance.
* @param capacitance The other Capacitance.
* @returns A new Capacitance instance with the results.
*/
add(capacitance: Capacitance): Capacitance;
/**
* Subtract the given Capacitance with the current Capacitance.
* @param capacitance The other Capacitance.
* @returns A new Capacitance instance with the results.
*/
subtract(capacitance: Capacitance): Capacitance;
/**
* Multiply the given Capacitance with the current Capacitance.
* @param capacitance The other Capacitance.
* @returns A new Capacitance instance with the results.
*/
multiply(capacitance: Capacitance): Capacitance;
/**
* Divide the given Capacitance with the current Capacitance.
* @param capacitance The other Capacitance.
* @returns A new Capacitance instance with the results.
*/
divide(capacitance: Capacitance): Capacitance;
/**
* Modulo the given Capacitance with the current Capacitance.
* @param capacitance The other Capacitance.
* @returns A new Capacitance instance with the results.
*/
modulo(capacitance: Capacitance): Capacitance;
/**
* Pow the given Capacitance with the current Capacitance.
* @param capacitance The other Capacitance.
* @returns A new Capacitance instance with the results.
*/
pow(capacitance: Capacitance): Capacitance;
}