• 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.

    Returns

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

    Example

    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' }

    Parameters

    • label: string

      The label to check for.

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