Class UnitDatabase

The central database where all units are registered and cached.

Hierarchy

  • UnitDatabase

Constructors

Accessors

Methods

  • Return a unit that can be used when dividing two numbers together.

    Parameters

    • unit0: HUnit

      The first unit to divide by.

    • unit1: HUnit

      The second unit to divide by.

    Returns HUnit

    The unit to divide by.

    Throws

    An error if the units can't be divided.

  • Get a unit via its id or undefined if it can't be found.

    Parameters

    • id: string

      The unit's id.

    Returns undefined | HUnit

    The unit or undefined.

  • Returns all the units for the specified quantity.

    Parameters

    • quanity: string

      The quantity to search for.

    Returns readonly HUnit[]

    An array of units.

  • Return a unit that can be used when multiplying two numbers together.

    Parameters

    • unit0: HUnit

      The first unit to multiply by.

    • unit1: HUnit

      The second unit to multiply by.

    Returns HUnit

    The unit to multiply by.

    Throws

    An error if the units can't be multiplied.

Generated using TypeDoc