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