UNPKG

unitsnet-js

Version:

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

771 lines (770 loc) 25.8 kB
import { BaseUnit, ToStringOptions } from "../base-unit"; /** API DTO represents a Volume */ export interface VolumeDto { /** The value of the Volume */ value: number; /** The specific unit that the Volume value is representing */ unit: VolumeUnits; } /** VolumeUnits enumeration */ export declare enum VolumeUnits { /** */ Liters = "Liter", /** */ CubicMeters = "CubicMeter", /** */ CubicKilometers = "CubicKilometer", /** */ CubicHectometers = "CubicHectometer", /** */ CubicDecimeters = "CubicDecimeter", /** */ CubicCentimeters = "CubicCentimeter", /** */ CubicMillimeters = "CubicMillimeter", /** */ CubicMicrometers = "CubicMicrometer", /** */ CubicMiles = "CubicMile", /** */ CubicYards = "CubicYard", /** */ CubicFeet = "CubicFoot", /** */ CubicInches = "CubicInch", /** The British imperial gallon (frequently called simply "gallon") is defined as exactly 4.54609 litres. */ ImperialGallons = "ImperialGallon", /** */ ImperialOunces = "ImperialOunce", /** The US liquid gallon (frequently called simply "gallon") is legally defined as 231 cubic inches, which is exactly 3.785411784 litres. */ UsGallons = "UsGallon", /** */ UsOunces = "UsOunce", /** */ UsTablespoons = "UsTablespoon", /** */ AuTablespoons = "AuTablespoon", /** */ UkTablespoons = "UkTablespoon", /** */ MetricTeaspoons = "MetricTeaspoon", /** */ UsTeaspoons = "UsTeaspoon", /** */ MetricCups = "MetricCup", /** */ UsCustomaryCups = "UsCustomaryCup", /** */ UsLegalCups = "UsLegalCup", /** */ OilBarrels = "OilBarrel", /** */ UsBeerBarrels = "UsBeerBarrel", /** */ ImperialBeerBarrels = "ImperialBeerBarrel", /** */ UsQuarts = "UsQuart", /** */ ImperialQuarts = "ImperialQuart", /** */ UsPints = "UsPint", /** */ AcreFeet = "AcreFoot", /** */ ImperialPints = "ImperialPint", /** */ BoardFeet = "BoardFoot", /** */ Nanoliters = "Nanoliter", /** */ Microliters = "Microliter", /** */ Milliliters = "Milliliter", /** */ Centiliters = "Centiliter", /** */ Deciliters = "Deciliter", /** */ Decaliters = "Decaliter", /** */ Hectoliters = "Hectoliter", /** */ Kiloliters = "Kiloliter", /** */ Megaliters = "Megaliter", /** */ HectocubicMeters = "HectocubicMeter", /** */ KilocubicMeters = "KilocubicMeter", /** */ HectocubicFeet = "HectocubicFoot", /** */ KilocubicFeet = "KilocubicFoot", /** */ MegacubicFeet = "MegacubicFoot", /** */ KiloimperialGallons = "KiloimperialGallon", /** */ MegaimperialGallons = "MegaimperialGallon", /** */ DecausGallons = "DecausGallon", /** */ DeciusGallons = "DeciusGallon", /** */ HectousGallons = "HectousGallon", /** */ KilousGallons = "KilousGallon", /** */ MegausGallons = "MegausGallon" } /** Volume is the quantity of three-dimensional space enclosed by some closed boundary, for example, the space that a substance (solid, liquid, gas, or plasma) or shape occupies or contains.[1] Volume is often quantified numerically using the SI derived unit, the cubic metre. The volume of a container is generally understood to be the capacity of the container, i. e. the amount of fluid (gas or liquid) that the container could hold, rather than the amount of space the container itself displaces. */ export declare class Volume extends BaseUnit { protected value: number; private litersLazy; private cubicmetersLazy; private cubickilometersLazy; private cubichectometersLazy; private cubicdecimetersLazy; private cubiccentimetersLazy; private cubicmillimetersLazy; private cubicmicrometersLazy; private cubicmilesLazy; private cubicyardsLazy; private cubicfeetLazy; private cubicinchesLazy; private imperialgallonsLazy; private imperialouncesLazy; private usgallonsLazy; private usouncesLazy; private ustablespoonsLazy; private autablespoonsLazy; private uktablespoonsLazy; private metricteaspoonsLazy; private usteaspoonsLazy; private metriccupsLazy; private uscustomarycupsLazy; private uslegalcupsLazy; private oilbarrelsLazy; private usbeerbarrelsLazy; private imperialbeerbarrelsLazy; private usquartsLazy; private imperialquartsLazy; private uspintsLazy; private acrefeetLazy; private imperialpintsLazy; private boardfeetLazy; private nanolitersLazy; private microlitersLazy; private millilitersLazy; private centilitersLazy; private decilitersLazy; private decalitersLazy; private hectolitersLazy; private kilolitersLazy; private megalitersLazy; private hectocubicmetersLazy; private kilocubicmetersLazy; private hectocubicfeetLazy; private kilocubicfeetLazy; private megacubicfeetLazy; private kiloimperialgallonsLazy; private megaimperialgallonsLazy; private decausgallonsLazy; private deciusgallonsLazy; private hectousgallonsLazy; private kilousgallonsLazy; private megausgallonsLazy; /** * Create a new Volume. * @param value The value. * @param fromUnit The ‘Volume’ unit to create from. * The default unit is CubicMeters */ constructor(value: number, fromUnit?: VolumeUnits); /** * The base value of Volume is CubicMeters. * 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(): VolumeUnits.CubicMeters; /** */ get Liters(): number; /** */ get CubicMeters(): number; /** */ get CubicKilometers(): number; /** */ get CubicHectometers(): number; /** */ get CubicDecimeters(): number; /** */ get CubicCentimeters(): number; /** */ get CubicMillimeters(): number; /** */ get CubicMicrometers(): number; /** */ get CubicMiles(): number; /** */ get CubicYards(): number; /** */ get CubicFeet(): number; /** */ get CubicInches(): number; /** The British imperial gallon (frequently called simply "gallon") is defined as exactly 4.54609 litres. */ get ImperialGallons(): number; /** */ get ImperialOunces(): number; /** The US liquid gallon (frequently called simply "gallon") is legally defined as 231 cubic inches, which is exactly 3.785411784 litres. */ get UsGallons(): number; /** */ get UsOunces(): number; /** */ get UsTablespoons(): number; /** */ get AuTablespoons(): number; /** */ get UkTablespoons(): number; /** */ get MetricTeaspoons(): number; /** */ get UsTeaspoons(): number; /** */ get MetricCups(): number; /** */ get UsCustomaryCups(): number; /** */ get UsLegalCups(): number; /** */ get OilBarrels(): number; /** */ get UsBeerBarrels(): number; /** */ get ImperialBeerBarrels(): number; /** */ get UsQuarts(): number; /** */ get ImperialQuarts(): number; /** */ get UsPints(): number; /** */ get AcreFeet(): number; /** */ get ImperialPints(): number; /** */ get BoardFeet(): number; /** */ get Nanoliters(): number; /** */ get Microliters(): number; /** */ get Milliliters(): number; /** */ get Centiliters(): number; /** */ get Deciliters(): number; /** */ get Decaliters(): number; /** */ get Hectoliters(): number; /** */ get Kiloliters(): number; /** */ get Megaliters(): number; /** */ get HectocubicMeters(): number; /** */ get KilocubicMeters(): number; /** */ get HectocubicFeet(): number; /** */ get KilocubicFeet(): number; /** */ get MegacubicFeet(): number; /** */ get KiloimperialGallons(): number; /** */ get MegaimperialGallons(): number; /** */ get DecausGallons(): number; /** */ get DeciusGallons(): number; /** */ get HectousGallons(): number; /** */ get KilousGallons(): number; /** */ get MegausGallons(): number; /** * Create a new Volume instance from a Liters * * @param value The unit as Liters to create a new Volume from. * @returns The new Volume instance. */ static FromLiters(value: number): Volume; /** * Create a new Volume instance from a CubicMeters * * @param value The unit as CubicMeters to create a new Volume from. * @returns The new Volume instance. */ static FromCubicMeters(value: number): Volume; /** * Create a new Volume instance from a CubicKilometers * * @param value The unit as CubicKilometers to create a new Volume from. * @returns The new Volume instance. */ static FromCubicKilometers(value: number): Volume; /** * Create a new Volume instance from a CubicHectometers * * @param value The unit as CubicHectometers to create a new Volume from. * @returns The new Volume instance. */ static FromCubicHectometers(value: number): Volume; /** * Create a new Volume instance from a CubicDecimeters * * @param value The unit as CubicDecimeters to create a new Volume from. * @returns The new Volume instance. */ static FromCubicDecimeters(value: number): Volume; /** * Create a new Volume instance from a CubicCentimeters * * @param value The unit as CubicCentimeters to create a new Volume from. * @returns The new Volume instance. */ static FromCubicCentimeters(value: number): Volume; /** * Create a new Volume instance from a CubicMillimeters * * @param value The unit as CubicMillimeters to create a new Volume from. * @returns The new Volume instance. */ static FromCubicMillimeters(value: number): Volume; /** * Create a new Volume instance from a CubicMicrometers * * @param value The unit as CubicMicrometers to create a new Volume from. * @returns The new Volume instance. */ static FromCubicMicrometers(value: number): Volume; /** * Create a new Volume instance from a CubicMiles * * @param value The unit as CubicMiles to create a new Volume from. * @returns The new Volume instance. */ static FromCubicMiles(value: number): Volume; /** * Create a new Volume instance from a CubicYards * * @param value The unit as CubicYards to create a new Volume from. * @returns The new Volume instance. */ static FromCubicYards(value: number): Volume; /** * Create a new Volume instance from a CubicFeet * * @param value The unit as CubicFeet to create a new Volume from. * @returns The new Volume instance. */ static FromCubicFeet(value: number): Volume; /** * Create a new Volume instance from a CubicInches * * @param value The unit as CubicInches to create a new Volume from. * @returns The new Volume instance. */ static FromCubicInches(value: number): Volume; /** * Create a new Volume instance from a ImperialGallons * The British imperial gallon (frequently called simply "gallon") is defined as exactly 4.54609 litres. * @param value The unit as ImperialGallons to create a new Volume from. * @returns The new Volume instance. */ static FromImperialGallons(value: number): Volume; /** * Create a new Volume instance from a ImperialOunces * * @param value The unit as ImperialOunces to create a new Volume from. * @returns The new Volume instance. */ static FromImperialOunces(value: number): Volume; /** * Create a new Volume instance from a UsGallons * The US liquid gallon (frequently called simply "gallon") is legally defined as 231 cubic inches, which is exactly 3.785411784 litres. * @param value The unit as UsGallons to create a new Volume from. * @returns The new Volume instance. */ static FromUsGallons(value: number): Volume; /** * Create a new Volume instance from a UsOunces * * @param value The unit as UsOunces to create a new Volume from. * @returns The new Volume instance. */ static FromUsOunces(value: number): Volume; /** * Create a new Volume instance from a UsTablespoons * * @param value The unit as UsTablespoons to create a new Volume from. * @returns The new Volume instance. */ static FromUsTablespoons(value: number): Volume; /** * Create a new Volume instance from a AuTablespoons * * @param value The unit as AuTablespoons to create a new Volume from. * @returns The new Volume instance. */ static FromAuTablespoons(value: number): Volume; /** * Create a new Volume instance from a UkTablespoons * * @param value The unit as UkTablespoons to create a new Volume from. * @returns The new Volume instance. */ static FromUkTablespoons(value: number): Volume; /** * Create a new Volume instance from a MetricTeaspoons * * @param value The unit as MetricTeaspoons to create a new Volume from. * @returns The new Volume instance. */ static FromMetricTeaspoons(value: number): Volume; /** * Create a new Volume instance from a UsTeaspoons * * @param value The unit as UsTeaspoons to create a new Volume from. * @returns The new Volume instance. */ static FromUsTeaspoons(value: number): Volume; /** * Create a new Volume instance from a MetricCups * * @param value The unit as MetricCups to create a new Volume from. * @returns The new Volume instance. */ static FromMetricCups(value: number): Volume; /** * Create a new Volume instance from a UsCustomaryCups * * @param value The unit as UsCustomaryCups to create a new Volume from. * @returns The new Volume instance. */ static FromUsCustomaryCups(value: number): Volume; /** * Create a new Volume instance from a UsLegalCups * * @param value The unit as UsLegalCups to create a new Volume from. * @returns The new Volume instance. */ static FromUsLegalCups(value: number): Volume; /** * Create a new Volume instance from a OilBarrels * * @param value The unit as OilBarrels to create a new Volume from. * @returns The new Volume instance. */ static FromOilBarrels(value: number): Volume; /** * Create a new Volume instance from a UsBeerBarrels * * @param value The unit as UsBeerBarrels to create a new Volume from. * @returns The new Volume instance. */ static FromUsBeerBarrels(value: number): Volume; /** * Create a new Volume instance from a ImperialBeerBarrels * * @param value The unit as ImperialBeerBarrels to create a new Volume from. * @returns The new Volume instance. */ static FromImperialBeerBarrels(value: number): Volume; /** * Create a new Volume instance from a UsQuarts * * @param value The unit as UsQuarts to create a new Volume from. * @returns The new Volume instance. */ static FromUsQuarts(value: number): Volume; /** * Create a new Volume instance from a ImperialQuarts * * @param value The unit as ImperialQuarts to create a new Volume from. * @returns The new Volume instance. */ static FromImperialQuarts(value: number): Volume; /** * Create a new Volume instance from a UsPints * * @param value The unit as UsPints to create a new Volume from. * @returns The new Volume instance. */ static FromUsPints(value: number): Volume; /** * Create a new Volume instance from a AcreFeet * * @param value The unit as AcreFeet to create a new Volume from. * @returns The new Volume instance. */ static FromAcreFeet(value: number): Volume; /** * Create a new Volume instance from a ImperialPints * * @param value The unit as ImperialPints to create a new Volume from. * @returns The new Volume instance. */ static FromImperialPints(value: number): Volume; /** * Create a new Volume instance from a BoardFeet * * @param value The unit as BoardFeet to create a new Volume from. * @returns The new Volume instance. */ static FromBoardFeet(value: number): Volume; /** * Create a new Volume instance from a Nanoliters * * @param value The unit as Nanoliters to create a new Volume from. * @returns The new Volume instance. */ static FromNanoliters(value: number): Volume; /** * Create a new Volume instance from a Microliters * * @param value The unit as Microliters to create a new Volume from. * @returns The new Volume instance. */ static FromMicroliters(value: number): Volume; /** * Create a new Volume instance from a Milliliters * * @param value The unit as Milliliters to create a new Volume from. * @returns The new Volume instance. */ static FromMilliliters(value: number): Volume; /** * Create a new Volume instance from a Centiliters * * @param value The unit as Centiliters to create a new Volume from. * @returns The new Volume instance. */ static FromCentiliters(value: number): Volume; /** * Create a new Volume instance from a Deciliters * * @param value The unit as Deciliters to create a new Volume from. * @returns The new Volume instance. */ static FromDeciliters(value: number): Volume; /** * Create a new Volume instance from a Decaliters * * @param value The unit as Decaliters to create a new Volume from. * @returns The new Volume instance. */ static FromDecaliters(value: number): Volume; /** * Create a new Volume instance from a Hectoliters * * @param value The unit as Hectoliters to create a new Volume from. * @returns The new Volume instance. */ static FromHectoliters(value: number): Volume; /** * Create a new Volume instance from a Kiloliters * * @param value The unit as Kiloliters to create a new Volume from. * @returns The new Volume instance. */ static FromKiloliters(value: number): Volume; /** * Create a new Volume instance from a Megaliters * * @param value The unit as Megaliters to create a new Volume from. * @returns The new Volume instance. */ static FromMegaliters(value: number): Volume; /** * Create a new Volume instance from a HectocubicMeters * * @param value The unit as HectocubicMeters to create a new Volume from. * @returns The new Volume instance. */ static FromHectocubicMeters(value: number): Volume; /** * Create a new Volume instance from a KilocubicMeters * * @param value The unit as KilocubicMeters to create a new Volume from. * @returns The new Volume instance. */ static FromKilocubicMeters(value: number): Volume; /** * Create a new Volume instance from a HectocubicFeet * * @param value The unit as HectocubicFeet to create a new Volume from. * @returns The new Volume instance. */ static FromHectocubicFeet(value: number): Volume; /** * Create a new Volume instance from a KilocubicFeet * * @param value The unit as KilocubicFeet to create a new Volume from. * @returns The new Volume instance. */ static FromKilocubicFeet(value: number): Volume; /** * Create a new Volume instance from a MegacubicFeet * * @param value The unit as MegacubicFeet to create a new Volume from. * @returns The new Volume instance. */ static FromMegacubicFeet(value: number): Volume; /** * Create a new Volume instance from a KiloimperialGallons * * @param value The unit as KiloimperialGallons to create a new Volume from. * @returns The new Volume instance. */ static FromKiloimperialGallons(value: number): Volume; /** * Create a new Volume instance from a MegaimperialGallons * * @param value The unit as MegaimperialGallons to create a new Volume from. * @returns The new Volume instance. */ static FromMegaimperialGallons(value: number): Volume; /** * Create a new Volume instance from a DecausGallons * * @param value The unit as DecausGallons to create a new Volume from. * @returns The new Volume instance. */ static FromDecausGallons(value: number): Volume; /** * Create a new Volume instance from a DeciusGallons * * @param value The unit as DeciusGallons to create a new Volume from. * @returns The new Volume instance. */ static FromDeciusGallons(value: number): Volume; /** * Create a new Volume instance from a HectousGallons * * @param value The unit as HectousGallons to create a new Volume from. * @returns The new Volume instance. */ static FromHectousGallons(value: number): Volume; /** * Create a new Volume instance from a KilousGallons * * @param value The unit as KilousGallons to create a new Volume from. * @returns The new Volume instance. */ static FromKilousGallons(value: number): Volume; /** * Create a new Volume instance from a MegausGallons * * @param value The unit as MegausGallons to create a new Volume from. * @returns The new Volume instance. */ static FromMegausGallons(value: number): Volume; /** * Gets the base unit enumeration associated with Volume * @returns The unit enumeration that can be used to interact with this type */ protected static getUnitEnum(): typeof VolumeUnits; /** * 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(): VolumeUnits.CubicMeters; /** * Create API DTO represent a Volume unit. * @param holdInUnit The specific Volume unit to be used in the unit representation at the DTO */ toDto(holdInUnit?: VolumeUnits): VolumeDto; /** * Create a Volume unit from an API DTO representation. * @param dtoVolume The Volume API DTO representation */ static FromDto(dtoVolume: VolumeDto): Volume; /** * Convert Volume to a specific unit value. * @param toUnit The specific unit to convert to * @returns The value of the specific unit provided. */ convert(toUnit: VolumeUnits): number; private convertFromBase; private convertToBase; /** * Format the Volume to string. * Note! the default format for Volume is CubicMeters. * To specify the unit format set the 'unit' parameter. * @param unit The unit to format the Volume. * @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 Volume. */ toString(unit?: VolumeUnits, options?: number | ToStringOptions): string; /** * Get Volume unit abbreviation. * Note! the default abbreviation for Volume is CubicMeters. * To specify the unit abbreviation set the 'unitAbbreviation' parameter. * @param unitAbbreviation The unit abbreviation of the Volume. * @returns The abbreviation string of Volume. */ getUnitAbbreviation(unitAbbreviation?: VolumeUnits): string; /** * Check if the given Volume are equals to the current Volume. * @param volume The other Volume. * @returns True if the given Volume are equal to the current Volume. */ equals(volume: Volume): boolean; /** * Compare the given Volume against the current Volume. * @param volume The other Volume. * @returns 0 if they are equal, -1 if the current Volume is less then other, 1 if the current Volume is greater then other. */ compareTo(volume: Volume): number; /** * Add the given Volume with the current Volume. * @param volume The other Volume. * @returns A new Volume instance with the results. */ add(volume: Volume): Volume; /** * Subtract the given Volume with the current Volume. * @param volume The other Volume. * @returns A new Volume instance with the results. */ subtract(volume: Volume): Volume; /** * Multiply the given Volume with the current Volume. * @param volume The other Volume. * @returns A new Volume instance with the results. */ multiply(volume: Volume): Volume; /** * Divide the given Volume with the current Volume. * @param volume The other Volume. * @returns A new Volume instance with the results. */ divide(volume: Volume): Volume; /** * Modulo the given Volume with the current Volume. * @param volume The other Volume. * @returns A new Volume instance with the results. */ modulo(volume: Volume): Volume; /** * Pow the given Volume with the current Volume. * @param volume The other Volume. * @returns A new Volume instance with the results. */ pow(volume: Volume): Volume; }