MCPcopy Create free account
hub / github.com/dailydotdev/apps / readStorage

Function readStorage

packages/shared/src/lib/recentPages.ts:28–47  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

26const pendingMeta = new Map<string, RecentPageMeta>();
27
28const readStorage = (): RecentPage[] => {
29 if (typeof window === 'undefined') {
30 return [];
31 }
32 try {
33 const raw = window.localStorage.getItem(STORAGE_KEY);
34 const parsed = raw ? JSON.parse(raw) : [];
35 if (!Array.isArray(parsed)) {
36 return [];
37 }
38 return parsed.filter(
39 (item): item is RecentPage =>
40 !!item &&
41 typeof item.path === 'string' &&
42 typeof item.title === 'string',
43 );
44 } catch {
45 return [];
46 }
47};
48
49export const getRecentPages = (): RecentPage[] => {
50 if (cache === null) {

Callers 1

getRecentPagesFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected