Lime Web Components API Documentation - v6.27.0
    Preparing search index...

    Function findLimetypeByLabel

    • Creates a function to find a limetype by its label in a collection of limetypes.

      The returned function searches through a collection of limetypes and returns the first one that matches the given label. This function is typically used to generate a callback for decorators or other higher-order logic.

      Parameters

      • label: string

        The label of the limetype to find.

      Returns (limetypes: Record<string, LimeType>) => LimeType

      A function that takes a collection of limetypes and returns the first limetype that matches the label, or undefined if no match is found.

      import { findLimetypeByLabel } from '@limetech/lime-web-components';

      const limetypes = {
      company: { label: 'company', properties: {} },
      person: { label: 'person', properties: {} },
      };

      const findPersonLimetype = findLimetypeByLabel('person');
      const personLimetype = findPersonLimetype(limetypes);
      console.log(personLimetype); // { label: 'person', properties: {} }
      // Using `findLimetypeByLabel` as a callback for a decorator
      import { findLimetypeByLabel, SelectLimeTypes } from '@limetech/lime-web-components';

      @SelectLimeTypes({
      map: [findLimetypeByLabel('person')],
      })
      private personLimetype: LimeType;