@polgubau/utils
Version:
A collection of utility functions for TypeScript
18 lines (16 loc) • 739 B
text/typescript
declare const DEFAULT_KEYS: string[];
/**
* Retrieves the main field from an item object based on a predefined list of labels to highlight.
*
* @param item - The item object from which to extract the main field.
* @returns An object containing the key and value of the main field.
*
* The function searches for the first label in the `labelsToHighlight` array that exists in the item object.
* If a label is found, it returns an object with the label as the key and the corresponding value from the item.
* If no label is found, it returns the first key-value pair from the item object.
*/
declare const getMainField: (item: Record<string, any>) => {
key: string;
value: string;
};
export { DEFAULT_KEYS, getMainField };