Preparing search index...

    Function createEnergyLabelFromEprel

    • Creates an EnergyLabel instance from a product in EPREL, choosing the label from its productGroup.

      Pass the product as the EPREL public API returns it. Like createEnergyLabel, it bundles all the labels.

      Parameters

      • product: { productGroup: string }

        The product data from the EPREL API.

      Returns EnergyLabel<ProductName>

      An EnergyLabel instance ready to generate the SVG.

      If the product group has no label in this library.

      const response = await fetch('https://eprel.ec.europa.eu/api/product/1573269')
      const product = await response.json()

      const svgString = createEnergyLabelFromEprel(product).toString()