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

Function readStorage

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

Source from the content-addressed store, hash-verified

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

Callers 1

getRecentPagesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected