unitsnet-js
Version:
A better way to hold unit variables and easily convert to the destination unit
435 lines (434 loc) • 15.5 kB
TypeScript
import { BaseUnit, ToStringOptions } from "../base-unit";
/** API DTO represents a BitRate */
export interface BitRateDto {
/** The value of the BitRate */
value: number;
/** The specific unit that the BitRate value is representing */
unit: BitRateUnits;
}
/** BitRateUnits enumeration */
export declare enum BitRateUnits {
/** */
BitsPerSecond = "BitPerSecond",
/** */
BytesPerSecond = "BytePerSecond",
/** */
KilobitsPerSecond = "KilobitPerSecond",
/** */
MegabitsPerSecond = "MegabitPerSecond",
/** */
GigabitsPerSecond = "GigabitPerSecond",
/** */
TerabitsPerSecond = "TerabitPerSecond",
/** */
PetabitsPerSecond = "PetabitPerSecond",
/** */
ExabitsPerSecond = "ExabitPerSecond",
/** */
KibibitsPerSecond = "KibibitPerSecond",
/** */
MebibitsPerSecond = "MebibitPerSecond",
/** */
GibibitsPerSecond = "GibibitPerSecond",
/** */
TebibitsPerSecond = "TebibitPerSecond",
/** */
PebibitsPerSecond = "PebibitPerSecond",
/** */
ExbibitsPerSecond = "ExbibitPerSecond",
/** */
KilobytesPerSecond = "KilobytePerSecond",
/** */
MegabytesPerSecond = "MegabytePerSecond",
/** */
GigabytesPerSecond = "GigabytePerSecond",
/** */
TerabytesPerSecond = "TerabytePerSecond",
/** */
PetabytesPerSecond = "PetabytePerSecond",
/** */
ExabytesPerSecond = "ExabytePerSecond",
/** */
KibibytesPerSecond = "KibibytePerSecond",
/** */
MebibytesPerSecond = "MebibytePerSecond",
/** */
GibibytesPerSecond = "GibibytePerSecond",
/** */
TebibytesPerSecond = "TebibytePerSecond",
/** */
PebibytesPerSecond = "PebibytePerSecond",
/** */
ExbibytesPerSecond = "ExbibytePerSecond"
}
/** In telecommunications and computing, bit rate is the number of bits that are conveyed or processed per unit of time. */
export declare class BitRate extends BaseUnit {
protected value: number;
private bitspersecondLazy;
private bytespersecondLazy;
private kilobitspersecondLazy;
private megabitspersecondLazy;
private gigabitspersecondLazy;
private terabitspersecondLazy;
private petabitspersecondLazy;
private exabitspersecondLazy;
private kibibitspersecondLazy;
private mebibitspersecondLazy;
private gibibitspersecondLazy;
private tebibitspersecondLazy;
private pebibitspersecondLazy;
private exbibitspersecondLazy;
private kilobytespersecondLazy;
private megabytespersecondLazy;
private gigabytespersecondLazy;
private terabytespersecondLazy;
private petabytespersecondLazy;
private exabytespersecondLazy;
private kibibytespersecondLazy;
private mebibytespersecondLazy;
private gibibytespersecondLazy;
private tebibytespersecondLazy;
private pebibytespersecondLazy;
private exbibytespersecondLazy;
/**
* Create a new BitRate.
* @param value The value.
* @param fromUnit The ‘BitRate’ unit to create from.
* The default unit is BitsPerSecond
*/
constructor(value: number, fromUnit?: BitRateUnits);
/**
* The base value of BitRate is BitsPerSecond.
* 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(): BitRateUnits.BitsPerSecond;
/** */
get BitsPerSecond(): number;
/** */
get BytesPerSecond(): number;
/** */
get KilobitsPerSecond(): number;
/** */
get MegabitsPerSecond(): number;
/** */
get GigabitsPerSecond(): number;
/** */
get TerabitsPerSecond(): number;
/** */
get PetabitsPerSecond(): number;
/** */
get ExabitsPerSecond(): number;
/** */
get KibibitsPerSecond(): number;
/** */
get MebibitsPerSecond(): number;
/** */
get GibibitsPerSecond(): number;
/** */
get TebibitsPerSecond(): number;
/** */
get PebibitsPerSecond(): number;
/** */
get ExbibitsPerSecond(): number;
/** */
get KilobytesPerSecond(): number;
/** */
get MegabytesPerSecond(): number;
/** */
get GigabytesPerSecond(): number;
/** */
get TerabytesPerSecond(): number;
/** */
get PetabytesPerSecond(): number;
/** */
get ExabytesPerSecond(): number;
/** */
get KibibytesPerSecond(): number;
/** */
get MebibytesPerSecond(): number;
/** */
get GibibytesPerSecond(): number;
/** */
get TebibytesPerSecond(): number;
/** */
get PebibytesPerSecond(): number;
/** */
get ExbibytesPerSecond(): number;
/**
* Create a new BitRate instance from a BitsPerSecond
*
* @param value The unit as BitsPerSecond to create a new BitRate from.
* @returns The new BitRate instance.
*/
static FromBitsPerSecond(value: number): BitRate;
/**
* Create a new BitRate instance from a BytesPerSecond
*
* @param value The unit as BytesPerSecond to create a new BitRate from.
* @returns The new BitRate instance.
*/
static FromBytesPerSecond(value: number): BitRate;
/**
* Create a new BitRate instance from a KilobitsPerSecond
*
* @param value The unit as KilobitsPerSecond to create a new BitRate from.
* @returns The new BitRate instance.
*/
static FromKilobitsPerSecond(value: number): BitRate;
/**
* Create a new BitRate instance from a MegabitsPerSecond
*
* @param value The unit as MegabitsPerSecond to create a new BitRate from.
* @returns The new BitRate instance.
*/
static FromMegabitsPerSecond(value: number): BitRate;
/**
* Create a new BitRate instance from a GigabitsPerSecond
*
* @param value The unit as GigabitsPerSecond to create a new BitRate from.
* @returns The new BitRate instance.
*/
static FromGigabitsPerSecond(value: number): BitRate;
/**
* Create a new BitRate instance from a TerabitsPerSecond
*
* @param value The unit as TerabitsPerSecond to create a new BitRate from.
* @returns The new BitRate instance.
*/
static FromTerabitsPerSecond(value: number): BitRate;
/**
* Create a new BitRate instance from a PetabitsPerSecond
*
* @param value The unit as PetabitsPerSecond to create a new BitRate from.
* @returns The new BitRate instance.
*/
static FromPetabitsPerSecond(value: number): BitRate;
/**
* Create a new BitRate instance from a ExabitsPerSecond
*
* @param value The unit as ExabitsPerSecond to create a new BitRate from.
* @returns The new BitRate instance.
*/
static FromExabitsPerSecond(value: number): BitRate;
/**
* Create a new BitRate instance from a KibibitsPerSecond
*
* @param value The unit as KibibitsPerSecond to create a new BitRate from.
* @returns The new BitRate instance.
*/
static FromKibibitsPerSecond(value: number): BitRate;
/**
* Create a new BitRate instance from a MebibitsPerSecond
*
* @param value The unit as MebibitsPerSecond to create a new BitRate from.
* @returns The new BitRate instance.
*/
static FromMebibitsPerSecond(value: number): BitRate;
/**
* Create a new BitRate instance from a GibibitsPerSecond
*
* @param value The unit as GibibitsPerSecond to create a new BitRate from.
* @returns The new BitRate instance.
*/
static FromGibibitsPerSecond(value: number): BitRate;
/**
* Create a new BitRate instance from a TebibitsPerSecond
*
* @param value The unit as TebibitsPerSecond to create a new BitRate from.
* @returns The new BitRate instance.
*/
static FromTebibitsPerSecond(value: number): BitRate;
/**
* Create a new BitRate instance from a PebibitsPerSecond
*
* @param value The unit as PebibitsPerSecond to create a new BitRate from.
* @returns The new BitRate instance.
*/
static FromPebibitsPerSecond(value: number): BitRate;
/**
* Create a new BitRate instance from a ExbibitsPerSecond
*
* @param value The unit as ExbibitsPerSecond to create a new BitRate from.
* @returns The new BitRate instance.
*/
static FromExbibitsPerSecond(value: number): BitRate;
/**
* Create a new BitRate instance from a KilobytesPerSecond
*
* @param value The unit as KilobytesPerSecond to create a new BitRate from.
* @returns The new BitRate instance.
*/
static FromKilobytesPerSecond(value: number): BitRate;
/**
* Create a new BitRate instance from a MegabytesPerSecond
*
* @param value The unit as MegabytesPerSecond to create a new BitRate from.
* @returns The new BitRate instance.
*/
static FromMegabytesPerSecond(value: number): BitRate;
/**
* Create a new BitRate instance from a GigabytesPerSecond
*
* @param value The unit as GigabytesPerSecond to create a new BitRate from.
* @returns The new BitRate instance.
*/
static FromGigabytesPerSecond(value: number): BitRate;
/**
* Create a new BitRate instance from a TerabytesPerSecond
*
* @param value The unit as TerabytesPerSecond to create a new BitRate from.
* @returns The new BitRate instance.
*/
static FromTerabytesPerSecond(value: number): BitRate;
/**
* Create a new BitRate instance from a PetabytesPerSecond
*
* @param value The unit as PetabytesPerSecond to create a new BitRate from.
* @returns The new BitRate instance.
*/
static FromPetabytesPerSecond(value: number): BitRate;
/**
* Create a new BitRate instance from a ExabytesPerSecond
*
* @param value The unit as ExabytesPerSecond to create a new BitRate from.
* @returns The new BitRate instance.
*/
static FromExabytesPerSecond(value: number): BitRate;
/**
* Create a new BitRate instance from a KibibytesPerSecond
*
* @param value The unit as KibibytesPerSecond to create a new BitRate from.
* @returns The new BitRate instance.
*/
static FromKibibytesPerSecond(value: number): BitRate;
/**
* Create a new BitRate instance from a MebibytesPerSecond
*
* @param value The unit as MebibytesPerSecond to create a new BitRate from.
* @returns The new BitRate instance.
*/
static FromMebibytesPerSecond(value: number): BitRate;
/**
* Create a new BitRate instance from a GibibytesPerSecond
*
* @param value The unit as GibibytesPerSecond to create a new BitRate from.
* @returns The new BitRate instance.
*/
static FromGibibytesPerSecond(value: number): BitRate;
/**
* Create a new BitRate instance from a TebibytesPerSecond
*
* @param value The unit as TebibytesPerSecond to create a new BitRate from.
* @returns The new BitRate instance.
*/
static FromTebibytesPerSecond(value: number): BitRate;
/**
* Create a new BitRate instance from a PebibytesPerSecond
*
* @param value The unit as PebibytesPerSecond to create a new BitRate from.
* @returns The new BitRate instance.
*/
static FromPebibytesPerSecond(value: number): BitRate;
/**
* Create a new BitRate instance from a ExbibytesPerSecond
*
* @param value The unit as ExbibytesPerSecond to create a new BitRate from.
* @returns The new BitRate instance.
*/
static FromExbibytesPerSecond(value: number): BitRate;
/**
* Gets the base unit enumeration associated with BitRate
* @returns The unit enumeration that can be used to interact with this type
*/
protected static getUnitEnum(): typeof BitRateUnits;
/**
* 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(): BitRateUnits.BitsPerSecond;
/**
* Create API DTO represent a BitRate unit.
* @param holdInUnit The specific BitRate unit to be used in the unit representation at the DTO
*/
toDto(holdInUnit?: BitRateUnits): BitRateDto;
/**
* Create a BitRate unit from an API DTO representation.
* @param dtoBitRate The BitRate API DTO representation
*/
static FromDto(dtoBitRate: BitRateDto): BitRate;
/**
* Convert BitRate to a specific unit value.
* @param toUnit The specific unit to convert to
* @returns The value of the specific unit provided.
*/
convert(toUnit: BitRateUnits): number;
private convertFromBase;
private convertToBase;
/**
* Format the BitRate to string.
* Note! the default format for BitRate is BitsPerSecond.
* To specify the unit format set the 'unit' parameter.
* @param unit The unit to format the BitRate.
* @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 BitRate.
*/
toString(unit?: BitRateUnits, options?: number | ToStringOptions): string;
/**
* Get BitRate unit abbreviation.
* Note! the default abbreviation for BitRate is BitsPerSecond.
* To specify the unit abbreviation set the 'unitAbbreviation' parameter.
* @param unitAbbreviation The unit abbreviation of the BitRate.
* @returns The abbreviation string of BitRate.
*/
getUnitAbbreviation(unitAbbreviation?: BitRateUnits): string;
/**
* Check if the given BitRate are equals to the current BitRate.
* @param bitRate The other BitRate.
* @returns True if the given BitRate are equal to the current BitRate.
*/
equals(bitRate: BitRate): boolean;
/**
* Compare the given BitRate against the current BitRate.
* @param bitRate The other BitRate.
* @returns 0 if they are equal, -1 if the current BitRate is less then other, 1 if the current BitRate is greater then other.
*/
compareTo(bitRate: BitRate): number;
/**
* Add the given BitRate with the current BitRate.
* @param bitRate The other BitRate.
* @returns A new BitRate instance with the results.
*/
add(bitRate: BitRate): BitRate;
/**
* Subtract the given BitRate with the current BitRate.
* @param bitRate The other BitRate.
* @returns A new BitRate instance with the results.
*/
subtract(bitRate: BitRate): BitRate;
/**
* Multiply the given BitRate with the current BitRate.
* @param bitRate The other BitRate.
* @returns A new BitRate instance with the results.
*/
multiply(bitRate: BitRate): BitRate;
/**
* Divide the given BitRate with the current BitRate.
* @param bitRate The other BitRate.
* @returns A new BitRate instance with the results.
*/
divide(bitRate: BitRate): BitRate;
/**
* Modulo the given BitRate with the current BitRate.
* @param bitRate The other BitRate.
* @returns A new BitRate instance with the results.
*/
modulo(bitRate: BitRate): BitRate;
/**
* Pow the given BitRate with the current BitRate.
* @param bitRate The other BitRate.
* @returns A new BitRate instance with the results.
*/
pow(bitRate: BitRate): BitRate;
}