2import { Recipe } from "https://esm.town/v/tmcw/Recipe";
3
4export function sort(recipes: Map<string, Recipe>, materials: Material[]) {
5 const have = new Set(materials.map((m) => m.name));
6
5
6/** Get a cookie from the request or optionally from inflight */
7export function getCookie(c: Context, key: string): string | undefined {
8 const inflight = getInflight(c);
9 if (inflight.has(key)) {
5
6/** Set a cookie and keep track of it inflight */
7export function setCookie(c: Context, key: string, value: string) {
8 const inflight = getInflight(c);
9 inflight.set(key, value);
2import { Context } from "npm:hono@3.8.1";
3
4export function getInflight(c: Context) {
5 return InflightCookies.get(c) || new Map();
6}
24
25// TODO: refactor
26export function formatFloat(a: number) {
27 const intPart = Math.floor(a);
28 const remainder = Math.floor((a - intPart) * 100);
17import { html } from "https://esm.town/v/stevekrouse/html?v=5";
18
19export async function examplePost(req: Request) {
20 const { author, name } = extractValInfo(import.meta.url);
21 return html(await article(author, name));
2
3// Fetches a random joke.
4async function fetchRandomJoke() {
5 const response = await fetch(
6 "https://official-joke-api.appspot.com/random_joke",
2
3// Fetches a random joke.
4async function fetchRandomJoke() {
5 const response = await fetch(
6 "https://official-joke-api.appspot.com/random_joke",
2
3// Fetches a random joke.
4async function fetchRandomJoke() {
5 const response = await fetch(
6 "https://official-joke-api.appspot.com/random_joke",
2import { set } from "https://esm.town/v/std/set?v=11";
3
4export async function setTemp(temp: Request) {
5 const currentDate = new Date();
6 const timestamp = currentDate.getTime();
A helper function to build a file's email
Simple functional CSS library for Val Town
import { OpenAI } from "https://esm.town/v/std/openai";
export default async function(req: Request): Promise<Response> {
if (req.method === "OPTIONS") {
return new Response(null, {
headers: {
"Access-Control-Allow-Origin": "*",
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.