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

    Function hasLabel

    • Creates a function to check if a given object has a specific label.

      The returned function takes an object (a LimeType or LimeProperty) and checks whether it contains the specified label. This function is typically used as a callback for array methods like .find or .filter.

      Parameters

      • label: string

        The label to check for.

      Returns (object?: LimeProperty | LimeType) => boolean

      A function that takes an optional object and returns true if the label matches, or false otherwise.

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

      const properties = [
      { label: 'name', type: 'string' },
      { label: 'email', type: 'string' },
      ];

      const emailProperty = properties.find(hasLabel('email'));
      console.log(emailProperty); // { label: 'email', type: 'string' }