diff --git a/source/item/item.ts b/source/item/item.ts index 0ebf6f6..5a1a668 100644 --- a/source/item/item.ts +++ b/source/item/item.ts @@ -119,6 +119,23 @@ export async function createItem( return item; } +/** + * Get the item for a given key and {@link ItemKeyPrefix}. Note that this + * function assumes that the item definitely exists. + */ +export async function getItem( + key: string, + itemKeyPrefix: ItemKeyPrefix, +): Promise> { + return createValue({ + deserialize: deserializeItem, + serialize: serializeItem, + storage: storageForPrefix(itemKeyPrefix), + key, + value: undefined!, + }); +} + /** * Get all keys from storage that start with the {@link ItemKeyPrefix}. *