@openhps/core
    Preparing search index...

    Class Unit

    Unit

    const myUnit = new Unit("meter", {
    baseName: "length",
    aliases: ["m", "meters"],
    prefixes: 'decimal'
    })

    You can specify the prefix using the specifier(...) function.

    const nanoUnit = myUnit.specifier(UnitPrefix.NANO);
    

    Hierarchy (View Summary)

    Index
    UNIT_BASES: Map<string, string> = ...
    UNITS: Map<string, Unit> = ...
    UNKNOWN: Unit = ...
    • Find a unit by its name

      Parameters

      • name: string

        Unit name

      • OptionalbaseName: string

        Optional base name to specific result

      Returns Unit

      Unit if found

    • Get a unit from JSON

      Type Parameters

      Parameters

      • json: any

        JSON object

      Returns T

      Unit if found

    • Register a new unit

      Parameters

      • unit: Unit

        Unit to register

      • override: boolean = false

        Override an existing unit with the same name

      Returns Unit

      Registered unit