refactor(notes): rename raw to storage in loadNotes
This commit is contained in:
1 parent
32e8bc7837
commit
7325485ee3
1 file changed
+3
-3
@@ -3,11 +3,11 @@ import type { Note } from '../types/note'
|
||||
const STORAGE_KEY = 'notes'
|
||||
|
||||
export function loadNotes(): Note[] {
|
||||
const raw = localStorage.getItem(STORAGE_KEY)
|
||||
if (raw === null) return []
|
||||
const storage = localStorage.getItem(STORAGE_KEY)
|
||||
if (storage === null) return []
|
||||
|
||||
try {
|
||||
const parsed: unknown = JSON.parse(raw)
|
||||
const parsed: unknown = JSON.parse(storage)
|
||||
if (!Array.isArray(parsed)) return []
|
||||
return parsed.filter(isNote)
|
||||
} catch {
|
||||
|
||||
Reference in new issue
Block a user