Public
Script
December 4, 2023
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import { extractValInfo } from "https://esm.town/v/pomdtr/extractValInfo";
import { BlobPreset } from "https://esm.town/v/pomdtr/lowdb";
interface Day {
id: number;
input: string;
riddleUrl: string;
}
type Data = { days: Day[] };
const { key } = extractValInfo(import.meta.url);
const aocDb = await BlobPreset<Data>(key, { days: [] });
type AocDB = typeof aocDb;
async function updateAocDB(db: AocDB, day: number, input: string, riddleUrl: string) {
db.data.days.push({ id: day, input, riddleUrl });
return await db.write();
}
export { aocDb, updateAocDB };
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
December 4, 2023