portainer/app/react/docker/services/ItemView/TasksDatatable/meta.ts

18 lines
368 B
TypeScript
Raw Normal View History

type TableMeta = {
serviceName: string;
table: 'tasks';
};
export function getTableMeta(meta: unknown): TableMeta {
return isTableMeta(meta) ? meta : { table: 'tasks', serviceName: '' };
}
function isTableMeta(meta: unknown): meta is TableMeta {
return (
!!meta &&
typeof meta === 'object' &&
'table' in meta &&
meta.table === 'tasks'
);
}