@neutrium/quantity - v5.0.0
    Preparing search index...

    Function isQuantityDefinition

    • Validate the scalar and counted unit records of a quantity definition.

      Parameters

      • value: unknown

        Any value, including null or undefined.

      Returns value is QuantityDefinition

      Whether the value has a Decimal scalar and valid counted unit arrays. Invalid or unreadable properties return false. Inputs are never normalized in place.

      Checks registered unit/prefix tokens, positive safe-integer powers, and duplicate-count overflow. NaN and Infinity are valid Decimal scalars. This does not check physical temperature restrictions; construct a Quantity for those. Decimal instances from the same installed package, including clones, are accepted; serialized numeric or string scalars must first be converted to Decimal.

      import { isQuantityDefinition } from '@neutrium/quantity/guards.js';

      isQuantityDefinition({ scalar: 1 }); // false
      isQuantityDefinition(null); // false