Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface Unit<T>

A Typescript type corresponding to a specific runtime Unit.

Type parameters

Hierarchy

Implemented by

Index

Properties

Readonly attributes

attributes: UnitAttributes

Readonly html

html: Element & ViewOf<IUnitBase<T>>

Readonly id

id: string

Readonly key

key: T

Unique lookup key for this type.

Readonly name

name: string

Readonly si

si: Unit<T> & SI

Optional Readonly symbol

symbol: undefined | string

Readonly tex

tex: string

Optional Readonly varName

varName: undefined | string

Methods

add

  • Call to check units for addition/subtraction. Throws an error if the units are not the same.

    Parameters

    Returns Unit<T>

divide

fromSI

  • fromSI(v: number, unit: Unit): [number, this]
  • Convert the given value from (unprefixed) SI units, and return the converted value and corresponding unit (i.e. this unit).

    Parameters

    • v: number
    • unit: Unit

    Returns [number, this]

multiply

toHtml

toSI

  • toSI(v: number): [number, Unit]
  • Convert the given value to (unprefixed) SI units, and return the converted value and the corresponding SI unit.

    Parameters

    • v: number

    Returns [number, Unit]

toTex

Generated using TypeDoc