Newer
Older
import { writable } from "svelte-local-storage-store";
import type { Writable } from "svelte/store";
export const gameFactsStore: Writable<String[]> = writable("gameFacts", []);
gameFact: String,
factArray: String[]
): String[] {
if (!factArray.includes(gameFact)) {
return [...factArray, gameFact];
} else {
return factArray;
}
}
export function toggleFactInFactArray(
gameFact: String,
factArray: String[]
): String[] {
if (!factArray.includes(gameFact)) {
return [...factArray, gameFact];
} else {
return factArray.filter((f) => f !== gameFact);
}
}