Skip to content

Weight

The Weight object represents a weight of an item in a specific unit.

classDiagram
  direction LR
  class Weight{
    bool isZero
    float value
    string unit
    string formatValue
  }

It is possible to render the value of the weight by rendering the object directly.

source
{{ weight }}
output
20 kg

Properties

Attribute name Type Description
isZero bool Indicates if the weight is zero.
value float The value of the weight.
unit string The representation of a weight unit.
formatValue string Formatted value of the weight.

Examples

isZero property

{% if not weight.isZero %}
  {{ weight.formatValue }}
{% endif %}
20 kg

value property

{{ weight.value }}
20

unit property

{{ weight.unit }}
kg

formatValue property

{{ weight.formatValue }}
20 kg