unitsnet-js
Version:
A better way to hold unit variables and easily convert to the destination unit
519 lines (518 loc) • 18.9 kB
TypeScript
import { BaseUnit, ToStringOptions } from "../base-unit";
/** API DTO represents a Speed */
export interface SpeedDto {
/** The value of the Speed */
value: number;
/** The specific unit that the Speed value is representing */
unit: SpeedUnits;
}
/** SpeedUnits enumeration */
export declare enum SpeedUnits {
/** */
MetersPerSecond = "MeterPerSecond",
/** */
MetersPerMinutes = "MeterPerMinute",
/** */
MetersPerHour = "MeterPerHour",
/** */
FeetPerSecond = "FootPerSecond",
/** */
FeetPerMinute = "FootPerMinute",
/** */
FeetPerHour = "FootPerHour",
/** */
UsSurveyFeetPerSecond = "UsSurveyFootPerSecond",
/** */
UsSurveyFeetPerMinute = "UsSurveyFootPerMinute",
/** */
UsSurveyFeetPerHour = "UsSurveyFootPerHour",
/** */
InchesPerSecond = "InchPerSecond",
/** */
InchesPerMinute = "InchPerMinute",
/** */
InchesPerHour = "InchPerHour",
/** */
YardsPerSecond = "YardPerSecond",
/** */
YardsPerMinute = "YardPerMinute",
/** */
YardsPerHour = "YardPerHour",
/** The knot, by definition, is a unit of speed equals to 1 nautical mile per hour, which is exactly 1852.000 metres per hour. The length of the internationally agreed nautical mile is 1852 m. The US adopted the international definition in 1954, the UK adopted the international nautical mile definition in 1970. */
Knots = "Knot",
/** */
MilesPerHour = "MilePerHour",
/** */
Mach = "Mach",
/** */
NanometersPerSecond = "NanometerPerSecond",
/** */
MicrometersPerSecond = "MicrometerPerSecond",
/** */
MillimetersPerSecond = "MillimeterPerSecond",
/** */
CentimetersPerSecond = "CentimeterPerSecond",
/** */
DecimetersPerSecond = "DecimeterPerSecond",
/** */
KilometersPerSecond = "KilometerPerSecond",
/** */
NanometersPerMinutes = "NanometerPerMinute",
/** */
MicrometersPerMinutes = "MicrometerPerMinute",
/** */
MillimetersPerMinutes = "MillimeterPerMinute",
/** */
CentimetersPerMinutes = "CentimeterPerMinute",
/** */
DecimetersPerMinutes = "DecimeterPerMinute",
/** */
KilometersPerMinutes = "KilometerPerMinute",
/** */
MillimetersPerHour = "MillimeterPerHour",
/** */
CentimetersPerHour = "CentimeterPerHour",
/** */
KilometersPerHour = "KilometerPerHour"
}
/** In everyday use and in kinematics, the speed of an object is the magnitude of its velocity (the rate of change of its position); it is thus a scalar quantity.[1] The average speed of an object in an interval of time is the distance travelled by the object divided by the duration of the interval;[2] the instantaneous speed is the limit of the average speed as the duration of the time interval approaches zero. */
export declare class Speed extends BaseUnit {
protected value: number;
private meterspersecondLazy;
private metersperminutesLazy;
private metersperhourLazy;
private feetpersecondLazy;
private feetperminuteLazy;
private feetperhourLazy;
private ussurveyfeetpersecondLazy;
private ussurveyfeetperminuteLazy;
private ussurveyfeetperhourLazy;
private inchespersecondLazy;
private inchesperminuteLazy;
private inchesperhourLazy;
private yardspersecondLazy;
private yardsperminuteLazy;
private yardsperhourLazy;
private knotsLazy;
private milesperhourLazy;
private machLazy;
private nanometerspersecondLazy;
private micrometerspersecondLazy;
private millimeterspersecondLazy;
private centimeterspersecondLazy;
private decimeterspersecondLazy;
private kilometerspersecondLazy;
private nanometersperminutesLazy;
private micrometersperminutesLazy;
private millimetersperminutesLazy;
private centimetersperminutesLazy;
private decimetersperminutesLazy;
private kilometersperminutesLazy;
private millimetersperhourLazy;
private centimetersperhourLazy;
private kilometersperhourLazy;
/**
* Create a new Speed.
* @param value The value.
* @param fromUnit The ‘Speed’ unit to create from.
* The default unit is MetersPerSecond
*/
constructor(value: number, fromUnit?: SpeedUnits);
/**
* The base value of Speed is MetersPerSecond.
* 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(): SpeedUnits.MetersPerSecond;
/** */
get MetersPerSecond(): number;
/** */
get MetersPerMinutes(): number;
/** */
get MetersPerHour(): number;
/** */
get FeetPerSecond(): number;
/** */
get FeetPerMinute(): number;
/** */
get FeetPerHour(): number;
/** */
get UsSurveyFeetPerSecond(): number;
/** */
get UsSurveyFeetPerMinute(): number;
/** */
get UsSurveyFeetPerHour(): number;
/** */
get InchesPerSecond(): number;
/** */
get InchesPerMinute(): number;
/** */
get InchesPerHour(): number;
/** */
get YardsPerSecond(): number;
/** */
get YardsPerMinute(): number;
/** */
get YardsPerHour(): number;
/** The knot, by definition, is a unit of speed equals to 1 nautical mile per hour, which is exactly 1852.000 metres per hour. The length of the internationally agreed nautical mile is 1852 m. The US adopted the international definition in 1954, the UK adopted the international nautical mile definition in 1970. */
get Knots(): number;
/** */
get MilesPerHour(): number;
/** */
get Mach(): number;
/** */
get NanometersPerSecond(): number;
/** */
get MicrometersPerSecond(): number;
/** */
get MillimetersPerSecond(): number;
/** */
get CentimetersPerSecond(): number;
/** */
get DecimetersPerSecond(): number;
/** */
get KilometersPerSecond(): number;
/** */
get NanometersPerMinutes(): number;
/** */
get MicrometersPerMinutes(): number;
/** */
get MillimetersPerMinutes(): number;
/** */
get CentimetersPerMinutes(): number;
/** */
get DecimetersPerMinutes(): number;
/** */
get KilometersPerMinutes(): number;
/** */
get MillimetersPerHour(): number;
/** */
get CentimetersPerHour(): number;
/** */
get KilometersPerHour(): number;
/**
* Create a new Speed instance from a MetersPerSecond
*
* @param value The unit as MetersPerSecond to create a new Speed from.
* @returns The new Speed instance.
*/
static FromMetersPerSecond(value: number): Speed;
/**
* Create a new Speed instance from a MetersPerMinutes
*
* @param value The unit as MetersPerMinutes to create a new Speed from.
* @returns The new Speed instance.
*/
static FromMetersPerMinutes(value: number): Speed;
/**
* Create a new Speed instance from a MetersPerHour
*
* @param value The unit as MetersPerHour to create a new Speed from.
* @returns The new Speed instance.
*/
static FromMetersPerHour(value: number): Speed;
/**
* Create a new Speed instance from a FeetPerSecond
*
* @param value The unit as FeetPerSecond to create a new Speed from.
* @returns The new Speed instance.
*/
static FromFeetPerSecond(value: number): Speed;
/**
* Create a new Speed instance from a FeetPerMinute
*
* @param value The unit as FeetPerMinute to create a new Speed from.
* @returns The new Speed instance.
*/
static FromFeetPerMinute(value: number): Speed;
/**
* Create a new Speed instance from a FeetPerHour
*
* @param value The unit as FeetPerHour to create a new Speed from.
* @returns The new Speed instance.
*/
static FromFeetPerHour(value: number): Speed;
/**
* Create a new Speed instance from a UsSurveyFeetPerSecond
*
* @param value The unit as UsSurveyFeetPerSecond to create a new Speed from.
* @returns The new Speed instance.
*/
static FromUsSurveyFeetPerSecond(value: number): Speed;
/**
* Create a new Speed instance from a UsSurveyFeetPerMinute
*
* @param value The unit as UsSurveyFeetPerMinute to create a new Speed from.
* @returns The new Speed instance.
*/
static FromUsSurveyFeetPerMinute(value: number): Speed;
/**
* Create a new Speed instance from a UsSurveyFeetPerHour
*
* @param value The unit as UsSurveyFeetPerHour to create a new Speed from.
* @returns The new Speed instance.
*/
static FromUsSurveyFeetPerHour(value: number): Speed;
/**
* Create a new Speed instance from a InchesPerSecond
*
* @param value The unit as InchesPerSecond to create a new Speed from.
* @returns The new Speed instance.
*/
static FromInchesPerSecond(value: number): Speed;
/**
* Create a new Speed instance from a InchesPerMinute
*
* @param value The unit as InchesPerMinute to create a new Speed from.
* @returns The new Speed instance.
*/
static FromInchesPerMinute(value: number): Speed;
/**
* Create a new Speed instance from a InchesPerHour
*
* @param value The unit as InchesPerHour to create a new Speed from.
* @returns The new Speed instance.
*/
static FromInchesPerHour(value: number): Speed;
/**
* Create a new Speed instance from a YardsPerSecond
*
* @param value The unit as YardsPerSecond to create a new Speed from.
* @returns The new Speed instance.
*/
static FromYardsPerSecond(value: number): Speed;
/**
* Create a new Speed instance from a YardsPerMinute
*
* @param value The unit as YardsPerMinute to create a new Speed from.
* @returns The new Speed instance.
*/
static FromYardsPerMinute(value: number): Speed;
/**
* Create a new Speed instance from a YardsPerHour
*
* @param value The unit as YardsPerHour to create a new Speed from.
* @returns The new Speed instance.
*/
static FromYardsPerHour(value: number): Speed;
/**
* Create a new Speed instance from a Knots
* The knot, by definition, is a unit of speed equals to 1 nautical mile per hour, which is exactly 1852.000 metres per hour. The length of the internationally agreed nautical mile is 1852 m. The US adopted the international definition in 1954, the UK adopted the international nautical mile definition in 1970.
* @param value The unit as Knots to create a new Speed from.
* @returns The new Speed instance.
*/
static FromKnots(value: number): Speed;
/**
* Create a new Speed instance from a MilesPerHour
*
* @param value The unit as MilesPerHour to create a new Speed from.
* @returns The new Speed instance.
*/
static FromMilesPerHour(value: number): Speed;
/**
* Create a new Speed instance from a Mach
*
* @param value The unit as Mach to create a new Speed from.
* @returns The new Speed instance.
*/
static FromMach(value: number): Speed;
/**
* Create a new Speed instance from a NanometersPerSecond
*
* @param value The unit as NanometersPerSecond to create a new Speed from.
* @returns The new Speed instance.
*/
static FromNanometersPerSecond(value: number): Speed;
/**
* Create a new Speed instance from a MicrometersPerSecond
*
* @param value The unit as MicrometersPerSecond to create a new Speed from.
* @returns The new Speed instance.
*/
static FromMicrometersPerSecond(value: number): Speed;
/**
* Create a new Speed instance from a MillimetersPerSecond
*
* @param value The unit as MillimetersPerSecond to create a new Speed from.
* @returns The new Speed instance.
*/
static FromMillimetersPerSecond(value: number): Speed;
/**
* Create a new Speed instance from a CentimetersPerSecond
*
* @param value The unit as CentimetersPerSecond to create a new Speed from.
* @returns The new Speed instance.
*/
static FromCentimetersPerSecond(value: number): Speed;
/**
* Create a new Speed instance from a DecimetersPerSecond
*
* @param value The unit as DecimetersPerSecond to create a new Speed from.
* @returns The new Speed instance.
*/
static FromDecimetersPerSecond(value: number): Speed;
/**
* Create a new Speed instance from a KilometersPerSecond
*
* @param value The unit as KilometersPerSecond to create a new Speed from.
* @returns The new Speed instance.
*/
static FromKilometersPerSecond(value: number): Speed;
/**
* Create a new Speed instance from a NanometersPerMinutes
*
* @param value The unit as NanometersPerMinutes to create a new Speed from.
* @returns The new Speed instance.
*/
static FromNanometersPerMinutes(value: number): Speed;
/**
* Create a new Speed instance from a MicrometersPerMinutes
*
* @param value The unit as MicrometersPerMinutes to create a new Speed from.
* @returns The new Speed instance.
*/
static FromMicrometersPerMinutes(value: number): Speed;
/**
* Create a new Speed instance from a MillimetersPerMinutes
*
* @param value The unit as MillimetersPerMinutes to create a new Speed from.
* @returns The new Speed instance.
*/
static FromMillimetersPerMinutes(value: number): Speed;
/**
* Create a new Speed instance from a CentimetersPerMinutes
*
* @param value The unit as CentimetersPerMinutes to create a new Speed from.
* @returns The new Speed instance.
*/
static FromCentimetersPerMinutes(value: number): Speed;
/**
* Create a new Speed instance from a DecimetersPerMinutes
*
* @param value The unit as DecimetersPerMinutes to create a new Speed from.
* @returns The new Speed instance.
*/
static FromDecimetersPerMinutes(value: number): Speed;
/**
* Create a new Speed instance from a KilometersPerMinutes
*
* @param value The unit as KilometersPerMinutes to create a new Speed from.
* @returns The new Speed instance.
*/
static FromKilometersPerMinutes(value: number): Speed;
/**
* Create a new Speed instance from a MillimetersPerHour
*
* @param value The unit as MillimetersPerHour to create a new Speed from.
* @returns The new Speed instance.
*/
static FromMillimetersPerHour(value: number): Speed;
/**
* Create a new Speed instance from a CentimetersPerHour
*
* @param value The unit as CentimetersPerHour to create a new Speed from.
* @returns The new Speed instance.
*/
static FromCentimetersPerHour(value: number): Speed;
/**
* Create a new Speed instance from a KilometersPerHour
*
* @param value The unit as KilometersPerHour to create a new Speed from.
* @returns The new Speed instance.
*/
static FromKilometersPerHour(value: number): Speed;
/**
* Gets the base unit enumeration associated with Speed
* @returns The unit enumeration that can be used to interact with this type
*/
protected static getUnitEnum(): typeof SpeedUnits;
/**
* 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(): SpeedUnits.MetersPerSecond;
/**
* Create API DTO represent a Speed unit.
* @param holdInUnit The specific Speed unit to be used in the unit representation at the DTO
*/
toDto(holdInUnit?: SpeedUnits): SpeedDto;
/**
* Create a Speed unit from an API DTO representation.
* @param dtoSpeed The Speed API DTO representation
*/
static FromDto(dtoSpeed: SpeedDto): Speed;
/**
* Convert Speed to a specific unit value.
* @param toUnit The specific unit to convert to
* @returns The value of the specific unit provided.
*/
convert(toUnit: SpeedUnits): number;
private convertFromBase;
private convertToBase;
/**
* Format the Speed to string.
* Note! the default format for Speed is MetersPerSecond.
* To specify the unit format set the 'unit' parameter.
* @param unit The unit to format the Speed.
* @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 Speed.
*/
toString(unit?: SpeedUnits, options?: number | ToStringOptions): string;
/**
* Get Speed unit abbreviation.
* Note! the default abbreviation for Speed is MetersPerSecond.
* To specify the unit abbreviation set the 'unitAbbreviation' parameter.
* @param unitAbbreviation The unit abbreviation of the Speed.
* @returns The abbreviation string of Speed.
*/
getUnitAbbreviation(unitAbbreviation?: SpeedUnits): string;
/**
* Check if the given Speed are equals to the current Speed.
* @param speed The other Speed.
* @returns True if the given Speed are equal to the current Speed.
*/
equals(speed: Speed): boolean;
/**
* Compare the given Speed against the current Speed.
* @param speed The other Speed.
* @returns 0 if they are equal, -1 if the current Speed is less then other, 1 if the current Speed is greater then other.
*/
compareTo(speed: Speed): number;
/**
* Add the given Speed with the current Speed.
* @param speed The other Speed.
* @returns A new Speed instance with the results.
*/
add(speed: Speed): Speed;
/**
* Subtract the given Speed with the current Speed.
* @param speed The other Speed.
* @returns A new Speed instance with the results.
*/
subtract(speed: Speed): Speed;
/**
* Multiply the given Speed with the current Speed.
* @param speed The other Speed.
* @returns A new Speed instance with the results.
*/
multiply(speed: Speed): Speed;
/**
* Divide the given Speed with the current Speed.
* @param speed The other Speed.
* @returns A new Speed instance with the results.
*/
divide(speed: Speed): Speed;
/**
* Modulo the given Speed with the current Speed.
* @param speed The other Speed.
* @returns A new Speed instance with the results.
*/
modulo(speed: Speed): Speed;
/**
* Pow the given Speed with the current Speed.
* @param speed The other Speed.
* @returns A new Speed instance with the results.
*/
pow(speed: Speed): Speed;
}