UNPKG

unitsnet-js

Version:

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

627 lines (626 loc) 23.4 kB
import { BaseUnit, ToStringOptions } from "../base-unit"; /** API DTO represents a Length */ export interface LengthDto { /** The value of the Length */ value: number; /** The specific unit that the Length value is representing */ unit: LengthUnits; } /** LengthUnits enumeration */ export declare enum LengthUnits { /** */ Meters = "Meter", /** The statute mile was standardised between the British Commonwealth and the United States by an international agreement in 1959, when it was formally redefined with respect to SI units as exactly 1,609.344 metres. */ Miles = "Mile", /** The yard (symbol: yd) is an English unit of length in both the British imperial and US customary systems of measurement equalling 3 feet (or 36 inches). Since 1959 the yard has been by international agreement standardized as exactly 0.9144 meter. A distance of 1,760 yards is equal to 1 mile. */ Yards = "Yard", /** */ Feet = "Foot", /** In the United States, the foot was defined as 12 inches, with the inch being defined by the Mendenhall Order of 1893 as 39.37 inches = 1 m. This makes a U.S. survey foot exactly 1200/3937 meters. */ UsSurveyFeet = "UsSurveyFoot", /** */ Inches = "Inch", /** */ Mils = "Mil", /** */ NauticalMiles = "NauticalMile", /** */ Fathoms = "Fathom", /** */ Shackles = "Shackle", /** */ Microinches = "Microinch", /** */ PrinterPoints = "PrinterPoint", /** */ DtpPoints = "DtpPoint", /** */ PrinterPicas = "PrinterPica", /** */ DtpPicas = "DtpPica", /** */ Twips = "Twip", /** */ Hands = "Hand", /** One Astronomical Unit is the distance from the solar system Star, the sun, to planet Earth. */ AstronomicalUnits = "AstronomicalUnit", /** A parsec is defined as the distance at which one astronomical unit (AU) subtends an angle of one arcsecond. */ Parsecs = "Parsec", /** A Light Year (ly) is the distance that light travel during an Earth year, ie 365 days. */ LightYears = "LightYear", /** Solar radius is a ratio unit to the radius of the solar system star, the sun. */ SolarRadiuses = "SolarRadius", /** */ Chains = "Chain", /** Angstrom is a metric unit of length equal to 1e-10 meter */ Angstroms = "Angstrom", /** In radar-related subjects and in JTIDS, a data mile is a unit of distance equal to 6000 feet (1.8288 kilometres or 0.987 nautical miles). */ DataMiles = "DataMile", /** */ Femtometers = "Femtometer", /** */ Picometers = "Picometer", /** */ Nanometers = "Nanometer", /** */ Micrometers = "Micrometer", /** */ Millimeters = "Millimeter", /** */ Centimeters = "Centimeter", /** */ Decimeters = "Decimeter", /** */ Decameters = "Decameter", /** */ Hectometers = "Hectometer", /** */ Kilometers = "Kilometer", /** */ Megameters = "Megameter", /** */ Gigameters = "Gigameter", /** */ Kiloyards = "Kiloyard", /** */ Kilofeet = "Kilofoot", /** */ Kiloparsecs = "Kiloparsec", /** */ Megaparsecs = "Megaparsec", /** */ KilolightYears = "KilolightYear", /** */ MegalightYears = "MegalightYear" } /** Many different units of length have been used around the world. The main units in modern use are U.S. customary units in the United States and the Metric system elsewhere. British Imperial units are still used for some purposes in the United Kingdom and some other countries. The metric system is sub-divided into SI and non-SI units. */ export declare class Length extends BaseUnit { protected value: number; private metersLazy; private milesLazy; private yardsLazy; private feetLazy; private ussurveyfeetLazy; private inchesLazy; private milsLazy; private nauticalmilesLazy; private fathomsLazy; private shacklesLazy; private microinchesLazy; private printerpointsLazy; private dtppointsLazy; private printerpicasLazy; private dtppicasLazy; private twipsLazy; private handsLazy; private astronomicalunitsLazy; private parsecsLazy; private lightyearsLazy; private solarradiusesLazy; private chainsLazy; private angstromsLazy; private datamilesLazy; private femtometersLazy; private picometersLazy; private nanometersLazy; private micrometersLazy; private millimetersLazy; private centimetersLazy; private decimetersLazy; private decametersLazy; private hectometersLazy; private kilometersLazy; private megametersLazy; private gigametersLazy; private kiloyardsLazy; private kilofeetLazy; private kiloparsecsLazy; private megaparsecsLazy; private kilolightyearsLazy; private megalightyearsLazy; /** * Create a new Length. * @param value The value. * @param fromUnit The ‘Length’ unit to create from. * The default unit is Meters */ constructor(value: number, fromUnit?: LengthUnits); /** * The base value of Length is Meters. * 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(): LengthUnits.Meters; /** */ get Meters(): number; /** The statute mile was standardised between the British Commonwealth and the United States by an international agreement in 1959, when it was formally redefined with respect to SI units as exactly 1,609.344 metres. */ get Miles(): number; /** The yard (symbol: yd) is an English unit of length in both the British imperial and US customary systems of measurement equalling 3 feet (or 36 inches). Since 1959 the yard has been by international agreement standardized as exactly 0.9144 meter. A distance of 1,760 yards is equal to 1 mile. */ get Yards(): number; /** */ get Feet(): number; /** In the United States, the foot was defined as 12 inches, with the inch being defined by the Mendenhall Order of 1893 as 39.37 inches = 1 m. This makes a U.S. survey foot exactly 1200/3937 meters. */ get UsSurveyFeet(): number; /** */ get Inches(): number; /** */ get Mils(): number; /** */ get NauticalMiles(): number; /** */ get Fathoms(): number; /** */ get Shackles(): number; /** */ get Microinches(): number; /** */ get PrinterPoints(): number; /** */ get DtpPoints(): number; /** */ get PrinterPicas(): number; /** */ get DtpPicas(): number; /** */ get Twips(): number; /** */ get Hands(): number; /** One Astronomical Unit is the distance from the solar system Star, the sun, to planet Earth. */ get AstronomicalUnits(): number; /** A parsec is defined as the distance at which one astronomical unit (AU) subtends an angle of one arcsecond. */ get Parsecs(): number; /** A Light Year (ly) is the distance that light travel during an Earth year, ie 365 days. */ get LightYears(): number; /** Solar radius is a ratio unit to the radius of the solar system star, the sun. */ get SolarRadiuses(): number; /** */ get Chains(): number; /** Angstrom is a metric unit of length equal to 1e-10 meter */ get Angstroms(): number; /** In radar-related subjects and in JTIDS, a data mile is a unit of distance equal to 6000 feet (1.8288 kilometres or 0.987 nautical miles). */ get DataMiles(): number; /** */ get Femtometers(): number; /** */ get Picometers(): number; /** */ get Nanometers(): number; /** */ get Micrometers(): number; /** */ get Millimeters(): number; /** */ get Centimeters(): number; /** */ get Decimeters(): number; /** */ get Decameters(): number; /** */ get Hectometers(): number; /** */ get Kilometers(): number; /** */ get Megameters(): number; /** */ get Gigameters(): number; /** */ get Kiloyards(): number; /** */ get Kilofeet(): number; /** */ get Kiloparsecs(): number; /** */ get Megaparsecs(): number; /** */ get KilolightYears(): number; /** */ get MegalightYears(): number; /** * Create a new Length instance from a Meters * * @param value The unit as Meters to create a new Length from. * @returns The new Length instance. */ static FromMeters(value: number): Length; /** * Create a new Length instance from a Miles * The statute mile was standardised between the British Commonwealth and the United States by an international agreement in 1959, when it was formally redefined with respect to SI units as exactly 1,609.344 metres. * @param value The unit as Miles to create a new Length from. * @returns The new Length instance. */ static FromMiles(value: number): Length; /** * Create a new Length instance from a Yards * The yard (symbol: yd) is an English unit of length in both the British imperial and US customary systems of measurement equalling 3 feet (or 36 inches). Since 1959 the yard has been by international agreement standardized as exactly 0.9144 meter. A distance of 1,760 yards is equal to 1 mile. * @param value The unit as Yards to create a new Length from. * @returns The new Length instance. */ static FromYards(value: number): Length; /** * Create a new Length instance from a Feet * * @param value The unit as Feet to create a new Length from. * @returns The new Length instance. */ static FromFeet(value: number): Length; /** * Create a new Length instance from a UsSurveyFeet * In the United States, the foot was defined as 12 inches, with the inch being defined by the Mendenhall Order of 1893 as 39.37 inches = 1 m. This makes a U.S. survey foot exactly 1200/3937 meters. * @param value The unit as UsSurveyFeet to create a new Length from. * @returns The new Length instance. */ static FromUsSurveyFeet(value: number): Length; /** * Create a new Length instance from a Inches * * @param value The unit as Inches to create a new Length from. * @returns The new Length instance. */ static FromInches(value: number): Length; /** * Create a new Length instance from a Mils * * @param value The unit as Mils to create a new Length from. * @returns The new Length instance. */ static FromMils(value: number): Length; /** * Create a new Length instance from a NauticalMiles * * @param value The unit as NauticalMiles to create a new Length from. * @returns The new Length instance. */ static FromNauticalMiles(value: number): Length; /** * Create a new Length instance from a Fathoms * * @param value The unit as Fathoms to create a new Length from. * @returns The new Length instance. */ static FromFathoms(value: number): Length; /** * Create a new Length instance from a Shackles * * @param value The unit as Shackles to create a new Length from. * @returns The new Length instance. */ static FromShackles(value: number): Length; /** * Create a new Length instance from a Microinches * * @param value The unit as Microinches to create a new Length from. * @returns The new Length instance. */ static FromMicroinches(value: number): Length; /** * Create a new Length instance from a PrinterPoints * * @param value The unit as PrinterPoints to create a new Length from. * @returns The new Length instance. */ static FromPrinterPoints(value: number): Length; /** * Create a new Length instance from a DtpPoints * * @param value The unit as DtpPoints to create a new Length from. * @returns The new Length instance. */ static FromDtpPoints(value: number): Length; /** * Create a new Length instance from a PrinterPicas * * @param value The unit as PrinterPicas to create a new Length from. * @returns The new Length instance. */ static FromPrinterPicas(value: number): Length; /** * Create a new Length instance from a DtpPicas * * @param value The unit as DtpPicas to create a new Length from. * @returns The new Length instance. */ static FromDtpPicas(value: number): Length; /** * Create a new Length instance from a Twips * * @param value The unit as Twips to create a new Length from. * @returns The new Length instance. */ static FromTwips(value: number): Length; /** * Create a new Length instance from a Hands * * @param value The unit as Hands to create a new Length from. * @returns The new Length instance. */ static FromHands(value: number): Length; /** * Create a new Length instance from a AstronomicalUnits * One Astronomical Unit is the distance from the solar system Star, the sun, to planet Earth. * @param value The unit as AstronomicalUnits to create a new Length from. * @returns The new Length instance. */ static FromAstronomicalUnits(value: number): Length; /** * Create a new Length instance from a Parsecs * A parsec is defined as the distance at which one astronomical unit (AU) subtends an angle of one arcsecond. * @param value The unit as Parsecs to create a new Length from. * @returns The new Length instance. */ static FromParsecs(value: number): Length; /** * Create a new Length instance from a LightYears * A Light Year (ly) is the distance that light travel during an Earth year, ie 365 days. * @param value The unit as LightYears to create a new Length from. * @returns The new Length instance. */ static FromLightYears(value: number): Length; /** * Create a new Length instance from a SolarRadiuses * Solar radius is a ratio unit to the radius of the solar system star, the sun. * @param value The unit as SolarRadiuses to create a new Length from. * @returns The new Length instance. */ static FromSolarRadiuses(value: number): Length; /** * Create a new Length instance from a Chains * * @param value The unit as Chains to create a new Length from. * @returns The new Length instance. */ static FromChains(value: number): Length; /** * Create a new Length instance from a Angstroms * Angstrom is a metric unit of length equal to 1e-10 meter * @param value The unit as Angstroms to create a new Length from. * @returns The new Length instance. */ static FromAngstroms(value: number): Length; /** * Create a new Length instance from a DataMiles * In radar-related subjects and in JTIDS, a data mile is a unit of distance equal to 6000 feet (1.8288 kilometres or 0.987 nautical miles). * @param value The unit as DataMiles to create a new Length from. * @returns The new Length instance. */ static FromDataMiles(value: number): Length; /** * Create a new Length instance from a Femtometers * * @param value The unit as Femtometers to create a new Length from. * @returns The new Length instance. */ static FromFemtometers(value: number): Length; /** * Create a new Length instance from a Picometers * * @param value The unit as Picometers to create a new Length from. * @returns The new Length instance. */ static FromPicometers(value: number): Length; /** * Create a new Length instance from a Nanometers * * @param value The unit as Nanometers to create a new Length from. * @returns The new Length instance. */ static FromNanometers(value: number): Length; /** * Create a new Length instance from a Micrometers * * @param value The unit as Micrometers to create a new Length from. * @returns The new Length instance. */ static FromMicrometers(value: number): Length; /** * Create a new Length instance from a Millimeters * * @param value The unit as Millimeters to create a new Length from. * @returns The new Length instance. */ static FromMillimeters(value: number): Length; /** * Create a new Length instance from a Centimeters * * @param value The unit as Centimeters to create a new Length from. * @returns The new Length instance. */ static FromCentimeters(value: number): Length; /** * Create a new Length instance from a Decimeters * * @param value The unit as Decimeters to create a new Length from. * @returns The new Length instance. */ static FromDecimeters(value: number): Length; /** * Create a new Length instance from a Decameters * * @param value The unit as Decameters to create a new Length from. * @returns The new Length instance. */ static FromDecameters(value: number): Length; /** * Create a new Length instance from a Hectometers * * @param value The unit as Hectometers to create a new Length from. * @returns The new Length instance. */ static FromHectometers(value: number): Length; /** * Create a new Length instance from a Kilometers * * @param value The unit as Kilometers to create a new Length from. * @returns The new Length instance. */ static FromKilometers(value: number): Length; /** * Create a new Length instance from a Megameters * * @param value The unit as Megameters to create a new Length from. * @returns The new Length instance. */ static FromMegameters(value: number): Length; /** * Create a new Length instance from a Gigameters * * @param value The unit as Gigameters to create a new Length from. * @returns The new Length instance. */ static FromGigameters(value: number): Length; /** * Create a new Length instance from a Kiloyards * * @param value The unit as Kiloyards to create a new Length from. * @returns The new Length instance. */ static FromKiloyards(value: number): Length; /** * Create a new Length instance from a Kilofeet * * @param value The unit as Kilofeet to create a new Length from. * @returns The new Length instance. */ static FromKilofeet(value: number): Length; /** * Create a new Length instance from a Kiloparsecs * * @param value The unit as Kiloparsecs to create a new Length from. * @returns The new Length instance. */ static FromKiloparsecs(value: number): Length; /** * Create a new Length instance from a Megaparsecs * * @param value The unit as Megaparsecs to create a new Length from. * @returns The new Length instance. */ static FromMegaparsecs(value: number): Length; /** * Create a new Length instance from a KilolightYears * * @param value The unit as KilolightYears to create a new Length from. * @returns The new Length instance. */ static FromKilolightYears(value: number): Length; /** * Create a new Length instance from a MegalightYears * * @param value The unit as MegalightYears to create a new Length from. * @returns The new Length instance. */ static FromMegalightYears(value: number): Length; /** * Gets the base unit enumeration associated with Length * @returns The unit enumeration that can be used to interact with this type */ protected static getUnitEnum(): typeof LengthUnits; /** * 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(): LengthUnits.Meters; /** * Create API DTO represent a Length unit. * @param holdInUnit The specific Length unit to be used in the unit representation at the DTO */ toDto(holdInUnit?: LengthUnits): LengthDto; /** * Create a Length unit from an API DTO representation. * @param dtoLength The Length API DTO representation */ static FromDto(dtoLength: LengthDto): Length; /** * Convert Length to a specific unit value. * @param toUnit The specific unit to convert to * @returns The value of the specific unit provided. */ convert(toUnit: LengthUnits): number; private convertFromBase; private convertToBase; /** * Format the Length to string. * Note! the default format for Length is Meters. * To specify the unit format set the 'unit' parameter. * @param unit The unit to format the Length. * @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 Length. */ toString(unit?: LengthUnits, options?: number | ToStringOptions): string; /** * Get Length unit abbreviation. * Note! the default abbreviation for Length is Meters. * To specify the unit abbreviation set the 'unitAbbreviation' parameter. * @param unitAbbreviation The unit abbreviation of the Length. * @returns The abbreviation string of Length. */ getUnitAbbreviation(unitAbbreviation?: LengthUnits): string; /** * Check if the given Length are equals to the current Length. * @param length The other Length. * @returns True if the given Length are equal to the current Length. */ equals(length: Length): boolean; /** * Compare the given Length against the current Length. * @param length The other Length. * @returns 0 if they are equal, -1 if the current Length is less then other, 1 if the current Length is greater then other. */ compareTo(length: Length): number; /** * Add the given Length with the current Length. * @param length The other Length. * @returns A new Length instance with the results. */ add(length: Length): Length; /** * Subtract the given Length with the current Length. * @param length The other Length. * @returns A new Length instance with the results. */ subtract(length: Length): Length; /** * Multiply the given Length with the current Length. * @param length The other Length. * @returns A new Length instance with the results. */ multiply(length: Length): Length; /** * Divide the given Length with the current Length. * @param length The other Length. * @returns A new Length instance with the results. */ divide(length: Length): Length; /** * Modulo the given Length with the current Length. * @param length The other Length. * @returns A new Length instance with the results. */ modulo(length: Length): Length; /** * Pow the given Length with the current Length. * @param length The other Length. * @returns A new Length instance with the results. */ pow(length: Length): Length; }