Skip to content

Latest commit

 

History

History
841 lines (549 loc) · 31.3 KB

modules.md

File metadata and controls

841 lines (549 loc) · 31.3 KB

@skywardapps/ts-united-types / Exports

@skywardapps/ts-united-types

Table of contents

Classes

Functions

Functions

converter

converter<InT, OutT>(inV, inT, outV, outT): UnitConversion<InT, OutT>

Create a converter between one unit and another.

There are two ways to use this via overloads: 1. Any arbitrary units: provide the values and unit types. converter(1, 'meter', 100, 'centimeters') 2. Use convert-units to automatically generate the conversion. converter('m','cm'); This will only work for known units (see convert-units for a list).
It will enforce that both units are of the same category -- eg both are AREA or both are DISTANCE, etc.

Type parameters

Name Type
InT extends string
OutT extends string

Parameters

Name Type
inV number
inT InT
outV number
outT OutT

Returns

UnitConversion<InT, OutT>

Defined in

converter.ts:7

converter<InT, OutT>(inT, outT): OutT extends autoConverter.Area ? UnitConversion<InT, OutT> : UnitTypeError<"Mismatched unit type for converter", autoConverter.Area, OutT>

Create a converter between one unit and another.

There are two ways to use this via overloads: 1. Any arbitrary units: provide the values and unit types. converter(1, 'meter', 100, 'centimeters') 2. Use convert-units to automatically generate the conversion. converter('m','cm'); This will only work for known units (see convert-units for a list).
It will enforce that both units are of the same category -- eg both are AREA or both are DISTANCE, etc.

Type parameters

Name Type
InT extends Area
OutT extends string

Parameters

Name Type
inT InT
outT OutT

Returns

OutT extends autoConverter.Area ? UnitConversion<InT, OutT> : UnitTypeError<"Mismatched unit type for converter", autoConverter.Area, OutT>

Defined in

converter.ts:8

converter<InT, OutT>(inT, outT): OutT extends autoConverter.Distance ? UnitConversion<InT, OutT> : UnitTypeError<"Mismatched unit type for converter", autoConverter.Distance, OutT>

Create a converter between one unit and another.

There are two ways to use this via overloads: 1. Any arbitrary units: provide the values and unit types. converter(1, 'meter', 100, 'centimeters') 2. Use convert-units to automatically generate the conversion. converter('m','cm'); This will only work for known units (see convert-units for a list).
It will enforce that both units are of the same category -- eg both are AREA or both are DISTANCE, etc.

Type parameters

Name Type
InT extends Distance
OutT extends string

Parameters

Name Type
inT InT
outT OutT

Returns

OutT extends autoConverter.Distance ? UnitConversion<InT, OutT> : UnitTypeError<"Mismatched unit type for converter", autoConverter.Distance, OutT>

Defined in

converter.ts:9

converter<InT, OutT>(inT, outT): OutT extends autoConverter.Angle ? UnitConversion<InT, OutT> : UnitTypeError<"Mismatched unit type for converter", autoConverter.Angle, OutT>

Create a converter between one unit and another.

There are two ways to use this via overloads: 1. Any arbitrary units: provide the values and unit types. converter(1, 'meter', 100, 'centimeters') 2. Use convert-units to automatically generate the conversion. converter('m','cm'); This will only work for known units (see convert-units for a list).
It will enforce that both units are of the same category -- eg both are AREA or both are DISTANCE, etc.

Type parameters

Name Type
InT extends Angle
OutT extends string

Parameters

Name Type
inT InT
outT OutT

Returns

OutT extends autoConverter.Angle ? UnitConversion<InT, OutT> : UnitTypeError<"Mismatched unit type for converter", autoConverter.Angle, OutT>

Defined in

converter.ts:10

converter<InT, OutT>(inT, outT): OutT extends autoConverter.ApparentPower ? UnitConversion<InT, OutT> : UnitTypeError<"Mismatched unit type for converter", autoConverter.ApparentPower, OutT>

Create a converter between one unit and another.

There are two ways to use this via overloads: 1. Any arbitrary units: provide the values and unit types. converter(1, 'meter', 100, 'centimeters') 2. Use convert-units to automatically generate the conversion. converter('m','cm'); This will only work for known units (see convert-units for a list).
It will enforce that both units are of the same category -- eg both are AREA or both are DISTANCE, etc.

Type parameters

Name Type
InT extends ApparentPower
OutT extends string

Parameters

Name Type
inT InT
outT OutT

Returns

OutT extends autoConverter.ApparentPower ? UnitConversion<InT, OutT> : UnitTypeError<"Mismatched unit type for converter", autoConverter.ApparentPower, OutT>

Defined in

converter.ts:11

converter<InT, OutT>(inT, outT): OutT extends autoConverter.Current ? UnitConversion<InT, OutT> : UnitTypeError<"Mismatched unit type for converter", autoConverter.Current, OutT>

Create a converter between one unit and another.

There are two ways to use this via overloads: 1. Any arbitrary units: provide the values and unit types. converter(1, 'meter', 100, 'centimeters') 2. Use convert-units to automatically generate the conversion. converter('m','cm'); This will only work for known units (see convert-units for a list).
It will enforce that both units are of the same category -- eg both are AREA or both are DISTANCE, etc.

Type parameters

Name Type
InT extends Current
OutT extends string

Parameters

Name Type
inT InT
outT OutT

Returns

OutT extends autoConverter.Current ? UnitConversion<InT, OutT> : UnitTypeError<"Mismatched unit type for converter", autoConverter.Current, OutT>

Defined in

converter.ts:12

converter<InT, OutT>(inT, outT): OutT extends autoConverter.Ditgital ? UnitConversion<InT, OutT> : UnitTypeError<"Mismatched unit type for converter", autoConverter.Ditgital, OutT>

Create a converter between one unit and another.

There are two ways to use this via overloads: 1. Any arbitrary units: provide the values and unit types. converter(1, 'meter', 100, 'centimeters') 2. Use convert-units to automatically generate the conversion. converter('m','cm'); This will only work for known units (see convert-units for a list).
It will enforce that both units are of the same category -- eg both are AREA or both are DISTANCE, etc.

Type parameters

Name Type
InT extends Ditgital
OutT extends string

Parameters

Name Type
inT InT
outT OutT

Returns

OutT extends autoConverter.Ditgital ? UnitConversion<InT, OutT> : UnitTypeError<"Mismatched unit type for converter", autoConverter.Ditgital, OutT>

Defined in

converter.ts:13

converter<InT, OutT>(inT, outT): OutT extends autoConverter.Energy ? UnitConversion<InT, OutT> : UnitTypeError<"Mismatched unit type for converter", autoConverter.Energy, OutT>

Create a converter between one unit and another.

There are two ways to use this via overloads: 1. Any arbitrary units: provide the values and unit types. converter(1, 'meter', 100, 'centimeters') 2. Use convert-units to automatically generate the conversion. converter('m','cm'); This will only work for known units (see convert-units for a list).
It will enforce that both units are of the same category -- eg both are AREA or both are DISTANCE, etc.

Type parameters

Name Type
InT extends Energy
OutT extends string

Parameters

Name Type
inT InT
outT OutT

Returns

OutT extends autoConverter.Energy ? UnitConversion<InT, OutT> : UnitTypeError<"Mismatched unit type for converter", autoConverter.Energy, OutT>

Defined in

converter.ts:14

converter<InT, OutT>(inT, outT): OutT extends autoConverter.Frequency ? UnitConversion<InT, OutT> : UnitTypeError<"Mismatched unit type for converter", autoConverter.Frequency, OutT>

Create a converter between one unit and another.

There are two ways to use this via overloads: 1. Any arbitrary units: provide the values and unit types. converter(1, 'meter', 100, 'centimeters') 2. Use convert-units to automatically generate the conversion. converter('m','cm'); This will only work for known units (see convert-units for a list).
It will enforce that both units are of the same category -- eg both are AREA or both are DISTANCE, etc.

Type parameters

Name Type
InT extends Frequency
OutT extends string

Parameters

Name Type
inT InT
outT OutT

Returns

OutT extends autoConverter.Frequency ? UnitConversion<InT, OutT> : UnitTypeError<"Mismatched unit type for converter", autoConverter.Frequency, OutT>

Defined in

converter.ts:15

converter<InT, OutT>(inT, outT): OutT extends autoConverter.Illuminance ? UnitConversion<InT, OutT> : UnitTypeError<"Mismatched unit type for converter", autoConverter.Illuminance, OutT>

Create a converter between one unit and another.

There are two ways to use this via overloads: 1. Any arbitrary units: provide the values and unit types. converter(1, 'meter', 100, 'centimeters') 2. Use convert-units to automatically generate the conversion. converter('m','cm'); This will only work for known units (see convert-units for a list).
It will enforce that both units are of the same category -- eg both are AREA or both are DISTANCE, etc.

Type parameters

Name Type
InT extends Illuminance
OutT extends string

Parameters

Name Type
inT InT
outT OutT

Returns

OutT extends autoConverter.Illuminance ? UnitConversion<InT, OutT> : UnitTypeError<"Mismatched unit type for converter", autoConverter.Illuminance, OutT>

Defined in

converter.ts:16

converter<InT, OutT>(inT, outT): OutT extends autoConverter.Mass ? UnitConversion<InT, OutT> : UnitTypeError<"Mismatched unit type for converter", autoConverter.Mass, OutT>

Create a converter between one unit and another.

There are two ways to use this via overloads: 1. Any arbitrary units: provide the values and unit types. converter(1, 'meter', 100, 'centimeters') 2. Use convert-units to automatically generate the conversion. converter('m','cm'); This will only work for known units (see convert-units for a list).
It will enforce that both units are of the same category -- eg both are AREA or both are DISTANCE, etc.

Type parameters

Name Type
InT extends Mass
OutT extends string

Parameters

Name Type
inT InT
outT OutT

Returns

OutT extends autoConverter.Mass ? UnitConversion<InT, OutT> : UnitTypeError<"Mismatched unit type for converter", autoConverter.Mass, OutT>

Defined in

converter.ts:17

converter<InT, OutT>(inT, outT): OutT extends autoConverter.Pace ? UnitConversion<InT, OutT> : UnitTypeError<"Mismatched unit type for converter", autoConverter.Pace, OutT>

Create a converter between one unit and another.

There are two ways to use this via overloads: 1. Any arbitrary units: provide the values and unit types. converter(1, 'meter', 100, 'centimeters') 2. Use convert-units to automatically generate the conversion. converter('m','cm'); This will only work for known units (see convert-units for a list).
It will enforce that both units are of the same category -- eg both are AREA or both are DISTANCE, etc.

Type parameters

Name Type
InT extends Pace
OutT extends string

Parameters

Name Type
inT InT
outT OutT

Returns

OutT extends autoConverter.Pace ? UnitConversion<InT, OutT> : UnitTypeError<"Mismatched unit type for converter", autoConverter.Pace, OutT>

Defined in

converter.ts:18

converter<InT, OutT>(inT, outT): OutT extends autoConverter.PartsPer ? UnitConversion<InT, OutT> : UnitTypeError<"Mismatched unit type for converter", autoConverter.PartsPer, OutT>

Create a converter between one unit and another.

There are two ways to use this via overloads: 1. Any arbitrary units: provide the values and unit types. converter(1, 'meter', 100, 'centimeters') 2. Use convert-units to automatically generate the conversion. converter('m','cm'); This will only work for known units (see convert-units for a list).
It will enforce that both units are of the same category -- eg both are AREA or both are DISTANCE, etc.

Type parameters

Name Type
InT extends PartsPer
OutT extends string

Parameters

Name Type
inT InT
outT OutT

Returns

OutT extends autoConverter.PartsPer ? UnitConversion<InT, OutT> : UnitTypeError<"Mismatched unit type for converter", autoConverter.PartsPer, OutT>

Defined in

converter.ts:19

converter<InT, OutT>(inT, outT): OutT extends autoConverter.Power ? UnitConversion<InT, OutT> : UnitTypeError<"Mismatched unit type for converter", autoConverter.Power, OutT>

Create a converter between one unit and another.

There are two ways to use this via overloads: 1. Any arbitrary units: provide the values and unit types. converter(1, 'meter', 100, 'centimeters') 2. Use convert-units to automatically generate the conversion. converter('m','cm'); This will only work for known units (see convert-units for a list).
It will enforce that both units are of the same category -- eg both are AREA or both are DISTANCE, etc.

Type parameters

Name Type
InT extends Power
OutT extends string

Parameters

Name Type
inT InT
outT OutT

Returns

OutT extends autoConverter.Power ? UnitConversion<InT, OutT> : UnitTypeError<"Mismatched unit type for converter", autoConverter.Power, OutT>

Defined in

converter.ts:20

converter<InT, OutT>(inT, outT): OutT extends autoConverter.Pressure ? UnitConversion<InT, OutT> : UnitTypeError<"Mismatched unit type for converter", autoConverter.Pressure, OutT>

Create a converter between one unit and another.

There are two ways to use this via overloads: 1. Any arbitrary units: provide the values and unit types. converter(1, 'meter', 100, 'centimeters') 2. Use convert-units to automatically generate the conversion. converter('m','cm'); This will only work for known units (see convert-units for a list).
It will enforce that both units are of the same category -- eg both are AREA or both are DISTANCE, etc.

Type parameters

Name Type
InT extends Pressure
OutT extends string

Parameters

Name Type
inT InT
outT OutT

Returns

OutT extends autoConverter.Pressure ? UnitConversion<InT, OutT> : UnitTypeError<"Mismatched unit type for converter", autoConverter.Pressure, OutT>

Defined in

converter.ts:21

converter<InT, OutT>(inT, outT): OutT extends autoConverter.ReactiveEnergy ? UnitConversion<InT, OutT> : UnitTypeError<"Mismatched unit type for converter", autoConverter.ReactiveEnergy, OutT>

Create a converter between one unit and another.

There are two ways to use this via overloads: 1. Any arbitrary units: provide the values and unit types. converter(1, 'meter', 100, 'centimeters') 2. Use convert-units to automatically generate the conversion. converter('m','cm'); This will only work for known units (see convert-units for a list).
It will enforce that both units are of the same category -- eg both are AREA or both are DISTANCE, etc.

Type parameters

Name Type
InT extends ReactiveEnergy
OutT extends string

Parameters

Name Type
inT InT
outT OutT

Returns

OutT extends autoConverter.ReactiveEnergy ? UnitConversion<InT, OutT> : UnitTypeError<"Mismatched unit type for converter", autoConverter.ReactiveEnergy, OutT>

Defined in

converter.ts:22

converter<InT, OutT>(inT, outT): OutT extends autoConverter.ReactivePower ? UnitConversion<InT, OutT> : UnitTypeError<"Mismatched unit type for converter", autoConverter.ReactivePower, OutT>

Create a converter between one unit and another.

There are two ways to use this via overloads: 1. Any arbitrary units: provide the values and unit types. converter(1, 'meter', 100, 'centimeters') 2. Use convert-units to automatically generate the conversion. converter('m','cm'); This will only work for known units (see convert-units for a list).
It will enforce that both units are of the same category -- eg both are AREA or both are DISTANCE, etc.

Type parameters

Name Type
InT extends ReactivePower
OutT extends string

Parameters

Name Type
inT InT
outT OutT

Returns

OutT extends autoConverter.ReactivePower ? UnitConversion<InT, OutT> : UnitTypeError<"Mismatched unit type for converter", autoConverter.ReactivePower, OutT>

Defined in

converter.ts:23

converter<InT, OutT>(inT, outT): OutT extends autoConverter.Speed ? UnitConversion<InT, OutT> : UnitTypeError<"Mismatched unit type for converter", autoConverter.Speed, OutT>

Create a converter between one unit and another.

There are two ways to use this via overloads: 1. Any arbitrary units: provide the values and unit types. converter(1, 'meter', 100, 'centimeters') 2. Use convert-units to automatically generate the conversion. converter('m','cm'); This will only work for known units (see convert-units for a list).
It will enforce that both units are of the same category -- eg both are AREA or both are DISTANCE, etc.

Type parameters

Name Type
InT extends Speed
OutT extends string

Parameters

Name Type
inT InT
outT OutT

Returns

OutT extends autoConverter.Speed ? UnitConversion<InT, OutT> : UnitTypeError<"Mismatched unit type for converter", autoConverter.Speed, OutT>

Defined in

converter.ts:24

converter<InT, OutT>(inT, outT): OutT extends autoConverter.Temperature ? UnitConversion<InT, OutT> : UnitTypeError<"Mismatched unit type for converter", autoConverter.Temperature, OutT>

Create a converter between one unit and another.

There are two ways to use this via overloads: 1. Any arbitrary units: provide the values and unit types. converter(1, 'meter', 100, 'centimeters') 2. Use convert-units to automatically generate the conversion. converter('m','cm'); This will only work for known units (see convert-units for a list).
It will enforce that both units are of the same category -- eg both are AREA or both are DISTANCE, etc.

Type parameters

Name Type
InT extends Temperature
OutT extends string

Parameters

Name Type
inT InT
outT OutT

Returns

OutT extends autoConverter.Temperature ? UnitConversion<InT, OutT> : UnitTypeError<"Mismatched unit type for converter", autoConverter.Temperature, OutT>

Defined in

converter.ts:25

converter<InT, OutT>(inT, outT): OutT extends autoConverter.Time ? UnitConversion<InT, OutT> : UnitTypeError<"Mismatched unit type for converter", autoConverter.Time, OutT>

Create a converter between one unit and another.

There are two ways to use this via overloads: 1. Any arbitrary units: provide the values and unit types. converter(1, 'meter', 100, 'centimeters') 2. Use convert-units to automatically generate the conversion. converter('m','cm'); This will only work for known units (see convert-units for a list).
It will enforce that both units are of the same category -- eg both are AREA or both are DISTANCE, etc.

Type parameters

Name Type
InT extends Time
OutT extends string

Parameters

Name Type
inT InT
outT OutT

Returns

OutT extends autoConverter.Time ? UnitConversion<InT, OutT> : UnitTypeError<"Mismatched unit type for converter", autoConverter.Time, OutT>

Defined in

converter.ts:26

converter<InT, OutT>(inT, outT): OutT extends autoConverter.Voltage ? UnitConversion<InT, OutT> : UnitTypeError<"Mismatched unit type for converter", autoConverter.Voltage, OutT>

Create a converter between one unit and another.

There are two ways to use this via overloads: 1. Any arbitrary units: provide the values and unit types. converter(1, 'meter', 100, 'centimeters') 2. Use convert-units to automatically generate the conversion. converter('m','cm'); This will only work for known units (see convert-units for a list).
It will enforce that both units are of the same category -- eg both are AREA or both are DISTANCE, etc.

Type parameters

Name Type
InT extends Voltage
OutT extends string

Parameters

Name Type
inT InT
outT OutT

Returns

OutT extends autoConverter.Voltage ? UnitConversion<InT, OutT> : UnitTypeError<"Mismatched unit type for converter", autoConverter.Voltage, OutT>

Defined in

converter.ts:27

converter<InT, OutT>(inT, outT): OutT extends autoConverter.Volume ? UnitConversion<InT, OutT> : UnitTypeError<"Mismatched unit type for converter", autoConverter.Volume, OutT>

Create a converter between one unit and another.

There are two ways to use this via overloads: 1. Any arbitrary units: provide the values and unit types. converter(1, 'meter', 100, 'centimeters') 2. Use convert-units to automatically generate the conversion. converter('m','cm'); This will only work for known units (see convert-units for a list).
It will enforce that both units are of the same category -- eg both are AREA or both are DISTANCE, etc.

Type parameters

Name Type
InT extends Volume
OutT extends string

Parameters

Name Type
inT InT
outT OutT

Returns

OutT extends autoConverter.Volume ? UnitConversion<InT, OutT> : UnitTypeError<"Mismatched unit type for converter", autoConverter.Volume, OutT>

Defined in

converter.ts:28

converter<InT, OutT>(inT, outT): OutT extends autoConverter.VolumeFlowRate ? UnitConversion<InT, OutT> : UnitTypeError<"Mismatched unit type for converter", autoConverter.VolumeFlowRate, OutT>

Create a converter between one unit and another.

There are two ways to use this via overloads: 1. Any arbitrary units: provide the values and unit types. converter(1, 'meter', 100, 'centimeters') 2. Use convert-units to automatically generate the conversion. converter('m','cm'); This will only work for known units (see convert-units for a list).
It will enforce that both units are of the same category -- eg both are AREA or both are DISTANCE, etc.

Type parameters

Name Type
InT extends VolumeFlowRate
OutT extends string

Parameters

Name Type
inT InT
outT OutT

Returns

OutT extends autoConverter.VolumeFlowRate ? UnitConversion<InT, OutT> : UnitTypeError<"Mismatched unit type for converter", autoConverter.VolumeFlowRate, OutT>

Defined in

converter.ts:29


ratio

ratio<InT, OutT>(inV, inT, outT): UnitedRatio<InT, OutT>

Type parameters

Name Type
InT extends string
OutT extends string

Parameters

Name Type
inV number
inT InT
outT OutT

Returns

UnitedRatio<InT, OutT>

Defined in

ratio.ts:6

ratio<InT, OutT>(inV, inT, outV, outT): UnitedRatio<InT, OutT>

Type parameters

Name Type
InT extends string
OutT extends string

Parameters

Name Type
inV number
inT InT
outV number
outT OutT

Returns

UnitedRatio<InT, OutT>

Defined in

ratio.ts:7


scalar

scalar<N>(v, u): UnitedScalar<N>

Type parameters

Name Type
N extends string

Parameters

Name Type
v number
u N

Returns

UnitedScalar<N>

Defined in

scalar.ts:4