Skip to content

Commit 4f074ec

Browse files
committed
refactor(guess-the-word): rename sanitizeStoredItem() to parseStoredItem()
1 parent 95fad67 commit 4f074ec

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

vanilla/guess-the-word/src/services/saved-words/load.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { discoveredWords } from "@/state/discovered-words";
2-
import { sanitizeStoredItem } from "./sanitize";
2+
import { parseStoredItem } from "./parse";
33
import { DIFFICULTIES_ALL } from "@/consts/difficulty";
44
import { DISCOVERED_WORDS } from "@/consts/discovered-words";
55

@@ -16,7 +16,7 @@ export const loadSavedWords = async (onLoadedWord) => {
1616
const savedItem = localStorage.getItem(DISCOVERED_WORDS.LOCAL_STORAGE_KEY);
1717

1818
if (oldSavedItem != null && savedItem == null) {
19-
const sanitized = sanitizeStoredItem(oldSavedItem);
19+
const sanitized = parseStoredItem(oldSavedItem);
2020
const { savedWordsLegacyAdapter } = await import("./old-format-adapter");
2121

2222
await savedWordsLegacyAdapter(sanitized, async (wordItem) => {
@@ -32,7 +32,7 @@ export const loadSavedWords = async (onLoadedWord) => {
3232
JSON.stringify(data),
3333
);
3434
} else if (savedItem != null) {
35-
const sanitized = sanitizeStoredItem(savedItem);
35+
const sanitized = parseStoredItem(savedItem);
3636
const { savedWordsAdapter } = await import("./adapter");
3737

3838
await savedWordsAdapter(sanitized, async (wordItem) => {

vanilla/guess-the-word/src/services/saved-words/sanitize.js renamed to vanilla/guess-the-word/src/services/saved-words/parse.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/** @param {any} item */
2-
export function sanitizeStoredItem(item) {
2+
export function parseStoredItem(item) {
33
try {
44
return JSON.parse(item);
55
} catch {

0 commit comments

Comments
 (0)