bigbuffet-rw/app/soapbox/entity-store/hooks/utils.ts

16 lines
370 B
TypeScript
Raw Normal View History

import type { EntitiesPath, ExpandedEntitiesPath } from './types';
2023-03-22 14:12:05 -07:00
function parseEntitiesPath(expandedPath: ExpandedEntitiesPath) {
const [entityType, ...listKeys] = expandedPath;
const listKey = (listKeys || []).join(':');
2023-03-22 14:12:05 -07:00
const path: EntitiesPath = [entityType, listKey];
return {
entityType,
listKey,
path,
};
}
export { parseEntitiesPath };