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

Function readStorage

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

Source from the content-addressed store, hash-verified

12const listeners = new Set<() => void>();
13
14const readStorage = (): RecentPage[] => {
15 if (typeof window === 'undefined') {
16 return [];
17 }
18 try {
19 const raw = window.localStorage.getItem(STORAGE_KEY);
20 const parsed = raw ? JSON.parse(raw) : [];
21 if (!Array.isArray(parsed)) {
22 return [];
23 }
24 return parsed.filter(
25 (item): item is RecentPage =>
26 !!item &&
27 typeof item.path === 'string' &&
28 typeof item.title === 'string',
29 );
30 } catch {
31 return [];
32 }
33};
34
35export const getRecentPages = (): RecentPage[] => {
36 if (cache === null) {

Callers 1

getRecentPagesFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected