npm.nicfv.com
    Preparing search index...

    Class Unit

    Represents a measurable unit.

    Hierarchy

    Index

    Constructors

    Properties

    Methods

    Constructors

    • Define a new named unit.

      Parameters

      • OptionalLaTeXsymbol: string | Map<Unit, number>

        The LaTeX code for this unit

      • Optionalbase: Dimension | Unit

        The base dimension or makeup of unit(s)

      • scale: number = 1

        The scale factor of this unit relative to the units in base

      • allowPrefix: boolean = true

        Whether or not this unit can have a prefix applied

      Returns Unit

    Properties

    dimensions: Dimension = ...

    The base dimensions of this unit.

    Methods

    • Determine if this compound is made up of the same factors as another.

      Parameters

      • other: Unit

        Another compound to compare to

      Returns boolean

      Whether or not this compound matches another

    • Divide this compound by another.

      Parameters

      • dividend: Unit

        The compound to divide by

      Returns Unit

      The quotient of two compounds

    • Raise this compound to an exponent.

      Parameters

      • exponent: number

        The exponent to raise this compound by

      Returns Unit

      The power of this compound and exponent

    • Scale this unit by applying a prefix.

      Parameters

      • prefix: Prefix

        The prefix to apply

      Returns Unit

      A properly scaled unit

    • Multiply this compound by another.

      Parameters

      • factor: Unit

        Another term or compound of similar terms

      Returns Unit

      The product of two compounds

    • Calculate the conversion factor between this unit and another unit.

      Parameters

      • other: Unit

        Another unit to convert to

      Returns number

      The conversion factor between this unit and another

    • Pretty-print this compound as a LaTeX formula.

      Returns string

      The compound written as a LaTeX formula