unitsnet-js
Version:
A better way to hold unit variables and easily convert to the destination unit
135 lines (134 loc) • 6.04 kB
TypeScript
import { BaseUnit, ToStringOptions } from "../base-unit";
/** API DTO represents a ElectricField */
export interface ElectricFieldDto {
/** The value of the ElectricField */
value: number;
/** The specific unit that the ElectricField value is representing */
unit: ElectricFieldUnits;
}
/** ElectricFieldUnits enumeration */
export declare enum ElectricFieldUnits {
/** */
VoltsPerMeter = "VoltPerMeter"
}
/** An electric field is a force field that surrounds electric charges that attracts or repels other electric charges. */
export declare class ElectricField extends BaseUnit {
protected value: number;
private voltspermeterLazy;
/**
* Create a new ElectricField.
* @param value The value.
* @param fromUnit The ‘ElectricField’ unit to create from.
* The default unit is VoltsPerMeter
*/
constructor(value: number, fromUnit?: ElectricFieldUnits);
/**
* The base value of ElectricField is VoltsPerMeter.
* 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(): ElectricFieldUnits.VoltsPerMeter;
/** */
get VoltsPerMeter(): number;
/**
* Create a new ElectricField instance from a VoltsPerMeter
*
* @param value The unit as VoltsPerMeter to create a new ElectricField from.
* @returns The new ElectricField instance.
*/
static FromVoltsPerMeter(value: number): ElectricField;
/**
* Gets the base unit enumeration associated with ElectricField
* @returns The unit enumeration that can be used to interact with this type
*/
protected static getUnitEnum(): typeof ElectricFieldUnits;
/**
* 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(): ElectricFieldUnits.VoltsPerMeter;
/**
* Create API DTO represent a ElectricField unit.
* @param holdInUnit The specific ElectricField unit to be used in the unit representation at the DTO
*/
toDto(holdInUnit?: ElectricFieldUnits): ElectricFieldDto;
/**
* Create a ElectricField unit from an API DTO representation.
* @param dtoElectricField The ElectricField API DTO representation
*/
static FromDto(dtoElectricField: ElectricFieldDto): ElectricField;
/**
* Convert ElectricField to a specific unit value.
* @param toUnit The specific unit to convert to
* @returns The value of the specific unit provided.
*/
convert(toUnit: ElectricFieldUnits): number;
private convertFromBase;
private convertToBase;
/**
* Format the ElectricField to string.
* Note! the default format for ElectricField is VoltsPerMeter.
* To specify the unit format set the 'unit' parameter.
* @param unit The unit to format the ElectricField.
* @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 ElectricField.
*/
toString(unit?: ElectricFieldUnits, options?: number | ToStringOptions): string;
/**
* Get ElectricField unit abbreviation.
* Note! the default abbreviation for ElectricField is VoltsPerMeter.
* To specify the unit abbreviation set the 'unitAbbreviation' parameter.
* @param unitAbbreviation The unit abbreviation of the ElectricField.
* @returns The abbreviation string of ElectricField.
*/
getUnitAbbreviation(unitAbbreviation?: ElectricFieldUnits): string;
/**
* Check if the given ElectricField are equals to the current ElectricField.
* @param electricField The other ElectricField.
* @returns True if the given ElectricField are equal to the current ElectricField.
*/
equals(electricField: ElectricField): boolean;
/**
* Compare the given ElectricField against the current ElectricField.
* @param electricField The other ElectricField.
* @returns 0 if they are equal, -1 if the current ElectricField is less then other, 1 if the current ElectricField is greater then other.
*/
compareTo(electricField: ElectricField): number;
/**
* Add the given ElectricField with the current ElectricField.
* @param electricField The other ElectricField.
* @returns A new ElectricField instance with the results.
*/
add(electricField: ElectricField): ElectricField;
/**
* Subtract the given ElectricField with the current ElectricField.
* @param electricField The other ElectricField.
* @returns A new ElectricField instance with the results.
*/
subtract(electricField: ElectricField): ElectricField;
/**
* Multiply the given ElectricField with the current ElectricField.
* @param electricField The other ElectricField.
* @returns A new ElectricField instance with the results.
*/
multiply(electricField: ElectricField): ElectricField;
/**
* Divide the given ElectricField with the current ElectricField.
* @param electricField The other ElectricField.
* @returns A new ElectricField instance with the results.
*/
divide(electricField: ElectricField): ElectricField;
/**
* Modulo the given ElectricField with the current ElectricField.
* @param electricField The other ElectricField.
* @returns A new ElectricField instance with the results.
*/
modulo(electricField: ElectricField): ElectricField;
/**
* Pow the given ElectricField with the current ElectricField.
* @param electricField The other ElectricField.
* @returns A new ElectricField instance with the results.
*/
pow(electricField: ElectricField): ElectricField;
}