units

units.validateUnits(originalTagUnitValue, tagUnitClassUnits, hedSchemaAttributes)

Validate a unit and strip it from the value.

Arguments:
  • originalTagUnitValue (string) – The unformatted version of the value.

  • tagUnitClassUnits (Array.<string>) – The list of valid units for this tag.

  • hedSchemaAttributes (SchemaAttributes) – The collection of schema attributes.

Returns:

isPrefixUnit(unit, hedSchemaAttributes)

Determine whether a unit is a valid prefix unit.

Arguments:
  • unit (string) – A unit string.

  • hedSchemaAttributes (SchemaAttributes) – The collection of schema attributes.

Returns:

boolean – Whether the unit is a valid prefix unit.

getValidDerivativeUnits(unit, hedSchemaAttributes)

Get the list of valid derivatives of a unit.

Arguments:
  • unit (string) – A unit string.

  • hedSchemaAttributes (SchemaAttributes) – The collection of schema attributes.

Returns:

Array.<string> – The list of valid derivative units.

getAllUnits()

Get the legal units for a particular HED tag.