2 * Wraps `content` between `open` and `close` content. If the content is a list, it puts each in a new line.
3 */
4export function wrap(open: string, content: string | string[], close: string): string {
5 let contentString: string = Array.isArray(content)
6 ? content.join("\n")
1import { fetch } from "https://esm.town/v/std/fetch";
2export async function checkHfs(url: string) {
3 const res = await (await fetch(url)).text();
4 return res.includes("HFS");
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
3
4export async function dailyDadJoke() {
5 let { setup, punchline } = await fetchJSON("https://official-joke-api.appspot.com/random_joke");
6 return email({
1export default async function untitled_jadeCarp(req: Request): Promise<Response> {
2 return Response.json(
3 [
9
10// ------------
11// Functions
12// ------------
13
14async function execute(statement: InStatement): Promise<ResultSet> {
15 const res = await fetch(`${API_URL}/v1/sqlite/execute`, {
16 method: "POST",
26}
27
28async function batch(statements: InStatement[], mode?: TransactionMode): Promise<ResultSet[]> {
29 const res = await fetch(`${API_URL}/v1/sqlite/batch`, {
30 method: "POST",
40}
41
42function createResError(body: string) {
43 try {
44 const e = zLibsqlError.parse(JSON.parse(body));
54`;
55
56function bigabs(x) {
57 return x < 0 ? -x : x;
58}
2import { valTownBlogJSON } from "https://esm.town/v/stevekrouse/valTownBlogJSON";
3
4export async function valTownBlogRSS() {
5 return Response.redirect("https://blog.val.town/rss.xml", 301);
6}
1import { email } from "https://esm.town/v/std/email";
2
3export function pdfPreviewPluginInstalled(siteURL, checker) {
4 // Define the approved sites array
5 let approvedSites = ["2917bc58d0dcfe0b3febd40f2c7eebf2"];
1import { callerRef, selfRef } from "https://esm.town/v/pomdtr/refs";
2
3export function hello() {
4 return `Hi ${callerRef().slug}, I'm ${selfRef().slug}`;
5}
2import StackTrace from "npm:stacktrace-js";
3
4export function selfRef() {
5 const stacktrace = StackTrace.getSync();
6 const moduleURL = stacktrace[1]?.fileName;
8}
9
10export function callerRef() {
11 const stacktrace = StackTrace.getSync();
12 const moduleURL = stacktrace[2]?.fileName;
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.