HED JavaScript Library
    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<SchemaAttribute>

        This unit's boolean attributes.

      • valueAttributes: Map<SchemaAttribute, string[]>

        This unit's key-value attributes.

      • unitModifiers: SchemaEntryManager<SchemaUnitModifier>

        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

    _compoundComponents: { base: string; exponent: number; text: string }[] | null

    The components of a compound SI unit such as m-per-s^2, or null for every other unit.

    _derivativeUnits: string[]

    The legal derivatives of this unit (non-compound units only): the name, its plural, and modified forms.

    _description: string | undefined

    The description of this schema entry.

    _modifierFactors: Map<string, number | null>

    The SI modifiers this unit accepts, mapped to their conversion factors (null if a modifier has none).

    _name: string

    The name of this schema entry.

    booleanAttributeNames: Set<string>

    The set of boolean attribute names this schema entry has.

    booleanAttributes: Set<SchemaAttribute>

    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<SchemaAttribute, string[]>

    The collection of value attributes this schema entry has.

    IGNORED_ATTRIBUTES: Set<string> = ...

    The attributes ignored when comparing two declarations of an element: inLibrary names the declaring library and hedId differs between schemas by construction.

    • 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, unknown>

      Each derivative unit string.

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

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

      Parameters

      • other: any

        A schema unit to compare with this one.

      Returns boolean

      Whether the other unit is equivalent to this schema unit.

    • 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.

    • 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.