mirror of
https://github.com/grafana/grafana.git
synced 2025-09-22 21:52:52 +08:00
11 lines
298 B
TypeScript
11 lines
298 B
TypeScript
import { DynamicTableItemProps } from '../components/DynamicTable';
|
|
|
|
export const prepareItems = <T = unknown>(
|
|
items: T[],
|
|
idCreator?: (item: T) => number | string
|
|
): Array<DynamicTableItemProps<T>> =>
|
|
items.map((item, index) => ({
|
|
id: idCreator?.(item) ?? index,
|
|
data: item,
|
|
}));
|