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'
|
const STORAGE_KEY = 'notes'
|
||||||
|
|
||||||
export function loadNotes(): Note[] {
|
export function loadNotes(): Note[] {
|
||||||
const raw = localStorage.getItem(STORAGE_KEY)
|
const storage = localStorage.getItem(STORAGE_KEY)
|
||||||
if (raw === null) return []
|
if (storage === null) return []
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const parsed: unknown = JSON.parse(raw)
|
const parsed: unknown = JSON.parse(storage)
|
||||||
if (!Array.isArray(parsed)) return []
|
if (!Array.isArray(parsed)) return []
|
||||||
return parsed.filter(isNote)
|
return parsed.filter(isNote)
|
||||||
} catch {
|
} catch {
|
||||||
|
|||||||
Reference in new issue
Block a user