20 boost: false,
21 query: {
22 function_score: {
23 query: {
24 bool: {
1export function hello(name) {
2 return "hi " + name;
3}
1import { extractValArgs } from "https://esm.town/v/sdan/extractValArgs";
2
3export async function getArgs(valName: string) {
4 const rep = await extractValArgs(valName);
5 return rep;
1export function proj(ll: Pos2): Pos2 {
2 // Arbitrary.
3 const D2R = Math.PI / 180;
1let { untitled_test_state } = await import("https://esm.town/v/stevekrouse/untitled_test_state");
2
3export function untitled_mutate_test_state(newState) {
4 return (untitled_test_state = newState);
5}
4 title: Val Town API
5 description: |
6 The Val Town API provides services to evaluate JavaScript and TypeScript expressions, run vals as APIs, either as functions or Express handlers.
7
8 Learn more at [https://docs.val.town](https://docs.val.town)
35 description: |
36 The JavaScript or TypeScript expression to be evaluated.
37 This should be a single expression, like a single function
38 call, assignment operation, or calculation. If you need
39 to execute multiple expressions, wrap them in a function.
40 schema:
41 type: string
44 value: "1+1"
45 summary: Simple addition
46 functionCall:
47 value: "@stevekrouse.addOne(@stevekrouse.example1)"
48 summary: Calling a user's val function
49 handle:
50 name: handle
71 summary: "id"
72 description: |
73 This val is a function that returns its arguments. It is useful for testing how the API handles the arguments passed to it.
74
75 View the val at [https://val.town/v/stevekrouse.id](https://val.town/v/stevekrouse.id)
92 value: 2
93 summary: Simple addition result
94 functionCall:
95 value: 42
96 summary: Calling a function result
97
98security:
1export function unescapeHtml(unsafe) {
2 return unsafe
3 .replace(/&/g, "&")
2import { email } from "https://esm.town/v/std/email?v=9";
3
4export async function handleFormExample2(params) {
5 await email({
6 text: JSON.stringify(params, null, 2),
4import { verifyAPIAuth } from "https://esm.town/v/stevekrouse/verifyAPIAuth";
5
6export async function r2Proxy(key, value, auth) {
7 let { handle } = await verifyAPIAuth(auth);
8 if (!handle)
1import { unescapeHtml } from "https://esm.town/v/stevekrouse/unescapeHtml";
2
3export async function htmlToMarkdown(str) {
4 let unescaped = await unescapeHtml(str);
5 return unescaped
A helper function to build a file's email
Simple functional CSS library for Val Town
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.
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": "*",