aboutsummaryrefslogtreecommitdiff
path: root/viewer/src/services/itemGuards.ts
diff options
context:
space:
mode:
Diffstat (limited to 'viewer/src/services/itemGuards.ts')
-rw-r--r--viewer/src/services/itemGuards.ts11
1 files changed, 11 insertions, 0 deletions
diff --git a/viewer/src/services/itemGuards.ts b/viewer/src/services/itemGuards.ts
new file mode 100644
index 0000000..114c2d9
--- /dev/null
+++ b/viewer/src/services/itemGuards.ts
@@ -0,0 +1,11 @@
1import { DirectoryItem, DownloadableItem, Item } from '@/@types/gallery';
2import { ItemType } from '@/@types/itemType';
3
4export function isDirectory(item: Item | null): item is DirectoryItem {
5 return item?.properties.type === ItemType.DIRECTORY;
6}
7
8export function isDownloadableItem(item: Item | null): item is DownloadableItem {
9 if (!item?.properties) return false;
10 return 'resource' in item.properties;
11}