Preparing search index...

    Class EnergyLabel<T>

    Energy label generator class that creates optimized SVG energy efficiency labels using configurable templates and data.

    import { EnergyLabel } from 'energy-label'

    // Create with default arrow template
    const label = new EnergyLabel()

    const svgString = label.toString()

    Type Parameters

    • T extends TemplateName = "arrow"

      The template name type, defaults to 'arrow'.

    Index

    Constructors

    Methods

    Constructors

    • Creates a new EnergyLabel instance with the specified template and data.

      Type Parameters

      Parameters

      • Optionaltemplate: T = ...

        The template name to use for generating the label.

      • Optionaldata: Partial<TemplatesData[T]> = {}

        Partial template data to customize the energy label.

      Returns EnergyLabel<T>

      const label = new EnergyLabel('smartphones', {
      flagOrigin: 'EU',
      supplierOrTrademark: 'Sultana',
      modelIdentifier: '92COU8944VK',
      eprelRegistrationNumber: '3712289',
      energyClass: 'D',
      batteryEndurancePerCycle: 4020,
      repeatedFreeFallReliabilityClass: 'C',
      repairabilityClass: 'E',
      batteryEnduranceInCycles: '3900',
      ingressProtectionRating: 'IP14'
      })

    Methods

    • Generates an optimized SVG string representation of the energy label.

      Returns string

      An optimized SVG string.

      May throw if template generation fails or SVG optimization encounters issues.