unitsnet-js
Version:
A better way to hold unit variables and easily convert to the destination unit
195 lines (194 loc) • 7.92 kB
TypeScript
import { BaseUnit, ToStringOptions } from "../base-unit";
/** API DTO represents a MagneticField */
export interface MagneticFieldDto {
/** The value of the MagneticField */
value: number;
/** The specific unit that the MagneticField value is representing */
unit: MagneticFieldUnits;
}
/** MagneticFieldUnits enumeration */
export declare enum MagneticFieldUnits {
/** */
Teslas = "Tesla",
/** */
Gausses = "Gauss",
/** */
Nanoteslas = "Nanotesla",
/** */
Microteslas = "Microtesla",
/** */
Milliteslas = "Millitesla",
/** */
Milligausses = "Milligauss"
}
/** A magnetic field is a force field that is created by moving electric charges (electric currents) and magnetic dipoles, and exerts a force on other nearby moving charges and magnetic dipoles. */
export declare class MagneticField extends BaseUnit {
protected value: number;
private teslasLazy;
private gaussesLazy;
private nanoteslasLazy;
private microteslasLazy;
private milliteslasLazy;
private milligaussesLazy;
/**
* Create a new MagneticField.
* @param value The value.
* @param fromUnit The ‘MagneticField’ unit to create from.
* The default unit is Teslas
*/
constructor(value: number, fromUnit?: MagneticFieldUnits);
/**
* The base value of MagneticField is Teslas.
* 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(): MagneticFieldUnits.Teslas;
/** */
get Teslas(): number;
/** */
get Gausses(): number;
/** */
get Nanoteslas(): number;
/** */
get Microteslas(): number;
/** */
get Milliteslas(): number;
/** */
get Milligausses(): number;
/**
* Create a new MagneticField instance from a Teslas
*
* @param value The unit as Teslas to create a new MagneticField from.
* @returns The new MagneticField instance.
*/
static FromTeslas(value: number): MagneticField;
/**
* Create a new MagneticField instance from a Gausses
*
* @param value The unit as Gausses to create a new MagneticField from.
* @returns The new MagneticField instance.
*/
static FromGausses(value: number): MagneticField;
/**
* Create a new MagneticField instance from a Nanoteslas
*
* @param value The unit as Nanoteslas to create a new MagneticField from.
* @returns The new MagneticField instance.
*/
static FromNanoteslas(value: number): MagneticField;
/**
* Create a new MagneticField instance from a Microteslas
*
* @param value The unit as Microteslas to create a new MagneticField from.
* @returns The new MagneticField instance.
*/
static FromMicroteslas(value: number): MagneticField;
/**
* Create a new MagneticField instance from a Milliteslas
*
* @param value The unit as Milliteslas to create a new MagneticField from.
* @returns The new MagneticField instance.
*/
static FromMilliteslas(value: number): MagneticField;
/**
* Create a new MagneticField instance from a Milligausses
*
* @param value The unit as Milligausses to create a new MagneticField from.
* @returns The new MagneticField instance.
*/
static FromMilligausses(value: number): MagneticField;
/**
* Gets the base unit enumeration associated with MagneticField
* @returns The unit enumeration that can be used to interact with this type
*/
protected static getUnitEnum(): typeof MagneticFieldUnits;
/**
* 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(): MagneticFieldUnits.Teslas;
/**
* Create API DTO represent a MagneticField unit.
* @param holdInUnit The specific MagneticField unit to be used in the unit representation at the DTO
*/
toDto(holdInUnit?: MagneticFieldUnits): MagneticFieldDto;
/**
* Create a MagneticField unit from an API DTO representation.
* @param dtoMagneticField The MagneticField API DTO representation
*/
static FromDto(dtoMagneticField: MagneticFieldDto): MagneticField;
/**
* Convert MagneticField to a specific unit value.
* @param toUnit The specific unit to convert to
* @returns The value of the specific unit provided.
*/
convert(toUnit: MagneticFieldUnits): number;
private convertFromBase;
private convertToBase;
/**
* Format the MagneticField to string.
* Note! the default format for MagneticField is Teslas.
* To specify the unit format set the 'unit' parameter.
* @param unit The unit to format the MagneticField.
* @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 MagneticField.
*/
toString(unit?: MagneticFieldUnits, options?: number | ToStringOptions): string;
/**
* Get MagneticField unit abbreviation.
* Note! the default abbreviation for MagneticField is Teslas.
* To specify the unit abbreviation set the 'unitAbbreviation' parameter.
* @param unitAbbreviation The unit abbreviation of the MagneticField.
* @returns The abbreviation string of MagneticField.
*/
getUnitAbbreviation(unitAbbreviation?: MagneticFieldUnits): string;
/**
* Check if the given MagneticField are equals to the current MagneticField.
* @param magneticField The other MagneticField.
* @returns True if the given MagneticField are equal to the current MagneticField.
*/
equals(magneticField: MagneticField): boolean;
/**
* Compare the given MagneticField against the current MagneticField.
* @param magneticField The other MagneticField.
* @returns 0 if they are equal, -1 if the current MagneticField is less then other, 1 if the current MagneticField is greater then other.
*/
compareTo(magneticField: MagneticField): number;
/**
* Add the given MagneticField with the current MagneticField.
* @param magneticField The other MagneticField.
* @returns A new MagneticField instance with the results.
*/
add(magneticField: MagneticField): MagneticField;
/**
* Subtract the given MagneticField with the current MagneticField.
* @param magneticField The other MagneticField.
* @returns A new MagneticField instance with the results.
*/
subtract(magneticField: MagneticField): MagneticField;
/**
* Multiply the given MagneticField with the current MagneticField.
* @param magneticField The other MagneticField.
* @returns A new MagneticField instance with the results.
*/
multiply(magneticField: MagneticField): MagneticField;
/**
* Divide the given MagneticField with the current MagneticField.
* @param magneticField The other MagneticField.
* @returns A new MagneticField instance with the results.
*/
divide(magneticField: MagneticField): MagneticField;
/**
* Modulo the given MagneticField with the current MagneticField.
* @param magneticField The other MagneticField.
* @returns A new MagneticField instance with the results.
*/
modulo(magneticField: MagneticField): MagneticField;
/**
* Pow the given MagneticField with the current MagneticField.
* @param magneticField The other MagneticField.
* @returns A new MagneticField instance with the results.
*/
pow(magneticField: MagneticField): MagneticField;
}