This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<svelte:options runes /> | |
<script> | |
import { store, increment } from './reactive.js'; | |
const deep = store.deep; | |
const remaining = $derived(store.items.filter((item) => !item.done).length); | |
function push() { | |
store.items.push({ text: 'bar', done: false }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function jsonAgg<T extends Record<string, AnyColumn>>(select: T) { | |
const chunks: SQL[] = []; | |
Object.entries(select).forEach(([key, column], index) => { | |
if (index > 0) chunks.push(sql`,`); | |
chunks.push(sql.raw(`'${key}',`), sql`${column}`); | |
}); | |
return sql<InferColumnsDataTypes<T>[]>` | |
coalesce( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import qs from "qs"; | |
import { z, ZodSchema } from "zod"; | |
import dayjs from "dayjs"; | |
import duration from "dayjs/plugin/duration"; | |
import { useEffect, useRef, useState } from "react"; | |
dayjs.extend(duration); | |
const parseObjectPrimitives = (obj: Record<string, any>): any => { | |
return Object.fromEntries( | |
Object.entries(obj).map(([k, v]) => { |