hed-typescript API
    Preparing search index...

    A schema unit.

    Hierarchy (View Summary)

    Index
    • Constructor.

      Parameters

      • name: string

        The name of this unit.

      • description: string | undefined

        The description of this unit.

      • booleanAttributes: Set<default>

        This unit's boolean attributes.

      • valueAttributes: Map<default, string[]>

        This unit's key-value attributes.

      • unitModifiers: default<default>

        The collection of unit modifiers (of every schema in the merge group, since units are built after the unit modifiers have been merged).

      Returns default

    booleanAttributeNames: Set<string>

    The set of boolean attribute names this schema entry has.

    booleanAttributes: Set<default>

    The set of boolean attributes this schema entry has.

    valueAttributeNames: Map<string, string[]>

    The collection of value attribute names this schema entry has.

    valueAttributes: Map<default, string[]>

    The collection of value attributes this schema entry has.

    • get description(): string | undefined

      The description of this schema entry.

      Returns string | undefined

    • Get the factor that converts a value given in a form of this unit to the unit class's base unit.

      Parameters

      • value: string

        A unit string accepted by validateUnit.

      Returns number | null

      The conversion factor, or null if this unit has no conversionFactor, the string is not a form of this unit, or a modifier used has no conversionFactor.

    • The legal derivatives of this unit.

      Returns Generator<string, void, void>

      A generator yielding each derivative unit string.

    • Determine if this schema unit is equivalent to another schema unit.

      Parameters

      • other: unknown

        A schema unit to compare with this one.

      Returns boolean

      Whether the other unit is equivalent to this schema unit.

      Schema units are deemed equivalent if they have the same name and equivalent attributes.

    • Retrieve a single value of a value attribute (by name) on this schema entry, throwing an error if more than one value exists.

      Parameters

      • attributeName: string

        The attribute whose value should be returned.

      Returns string | undefined

      The value of the attribute.

      If the attribute has more than one value.

    • Determine whether a unit string is this unit written without an SI modifier.

      Parameters

      • value: string

        A unit string.

      Returns boolean

      True if the string is this unit's name (a compound unit such as m-per-s included) or, for a unit that is not a symbol, its plural.

    • Get the SI modifiers a form of this unit uses.

      Parameters

      • value: string

        A unit string.

      Returns default[]

      The modifiers in the order they are written (one per component of a compound unit at most), or an empty array if none is used or the string is not a form of this unit.

    • Determine if a value has this unit.

      Parameters

      • value: string

        Either the whole value or the part after a blank (if not a prefix unit)

      Returns boolean

      Whether the value has these units.