Val Town Code SearchReturn to Val Town

API Access

You can access search results via JSON API by adding format=json to your query:

https://codesearch.val.run/$1?q=function&page=2392&format=json

For typeahead suggestions, use the /typeahead endpoint:

https://codesearch.val.run/typeahead?q=function

Returns an array of strings in format "username" or "username/projectName"

Found 28553 results for "function"(4226ms)

verbalScarletAntelopemain.tsx3 matches

@vawogbemi•Updated 7 months ago
7import About from "https://esm.town/v/vawogbemi/whoIsHiringAbout";
8
9function App() {
10 const tabs = { "/": "Home", "/about": "About" };
11 const [activeTab, setActiveTab] = useState("/");
352}
353
354function ServerApp() {
355 return (
356 <html>
375}
376
377export default async function(req: Request): Promise<Response> {
378 const url = new URL(req.url);
379 if (url.pathname === "/api/stories") {

forbearingOrangePlatypusmain.tsx7 matches

@Felistan•Updated 7 months ago
31
32// ------------
33// Functions
34// ------------
35
36async function execute(statement: InStatement, args?: InArgs): Promise<ResultSet> {
37 const res = await fetch(`${API_URL}/v1/sqlite/execute`, {
38 method: "POST",
49}
50
51async function batch(statements: InStatement[], mode?: TransactionMode): Promise<ResultSet[]> {
52 const res = await fetch(`${API_URL}/v1/sqlite/batch`, {
53 method: "POST",
64}
65
66function createResError(body: string) {
67 try {
68 const e = zLibsqlError.parse(JSON.parse(body));
85}
86
87function normalizeStatement(statement: InStatement, args?: InArgs) {
88 if (Array.isArray(statement)) {
89 // for the case of an array of arrays
107}
108
109function upgradeResultSet(results: ImpoverishedResultSet): ResultSet {
110 return {
111 ...results,
116// adapted from
117// https://github.com/tursodatabase/libsql-client-ts/blob/17dd996b840c950dd22b871adfe4ba0eb4a5ead3/packages/libsql-client/src/sqlite3.ts#L314C1-L337C2
118function rowFromSql(
119 sqlRow: Array<unknown>,
120 columns: Array<string>,

sqlitemain.tsx7 matches

@Felistan•Updated 7 months ago
31
32// ------------
33// Functions
34// ------------
35
36async function execute(statement: InStatement, args?: InArgs): Promise<ResultSet> {
37 const res = await fetch(`${API_URL}/v1/sqlite/execute`, {
38 method: "POST",
49}
50
51async function batch(statements: InStatement[], mode?: TransactionMode): Promise<ResultSet[]> {
52 const res = await fetch(`${API_URL}/v1/sqlite/batch`, {
53 method: "POST",
64}
65
66function createResError(body: string) {
67 try {
68 const e = zLibsqlError.parse(JSON.parse(body));
85}
86
87function normalizeStatement(statement: InStatement, args?: InArgs) {
88 if (Array.isArray(statement)) {
89 // for the case of an array of arrays
107}
108
109function upgradeResultSet(results: ImpoverishedResultSet): ResultSet {
110 return {
111 ...results,
116// adapted from
117// https://github.com/tursodatabase/libsql-client-ts/blob/17dd996b840c950dd22b871adfe4ba0eb4a5ead3/packages/libsql-client/src/sqlite3.ts#L314C1-L337C2
118function rowFromSql(
119 sqlRow: Array<unknown>,
120 columns: Array<string>,

falDemoAppmain.tsx3 matches

@ascarden•Updated 7 months ago
5import { falProxyRequest } from "https://esm.town/v/stevekrouse/falProxyRequest";
6
7function App() {
8 const [prompt, setPrompt] = useState("");
9 const [imageUrl, setImageUrl] = useState("");
103}
104
105function client() {
106 createRoot(document.getElementById("root")).render(<App />);
107}
108if (typeof document !== "undefined") { client(); }
109
110export default async function server(req: Request): Promise<Response> {
111 const url = new URL(req.url);
112 if (url.pathname === "/") {

FedifyOnValTownmain.tsx1 match

@minhee•Updated 7 months ago
160 });
161
162export default async function (req: Request): Promise<Response> {
163 const url = new URL(req.url);
164 if (url.pathname === "/") {

jubilantMagentaMitemain.tsx1 match

@youchen•Updated 7 months ago
8};
9
10async function handleRequest(request) {
11 const url = new URL(request.url);
12

sendxmppapimain.tsx1 match

@singpolyma•Updated 7 months ago
4const ratelimit = new RateLimit({ maximum: 2, interval: "30s" });
5
6export default async function(req: Request): Promise<Response> {
7 /*const limit = await ratelimit.check("val.town");
8 if (!limit.ok) {

sendxmppmain.tsx1 match

@singpolyma•Updated 7 months ago
1export default async function sendxmpp(target: string, body: string) {
2 await fetch("https://singpolyma-sendxmppapi.web.val.run", {
3 method: "POST",

getRandomFeedItemmain.tsx1 match

@xxxlovecola•Updated 7 months ago
1import Parser from "https://esm.sh/rss-parser@3.13.0";
2
3export default async function(req: Request): Promise<Response> {
4 const url = new URL(req.url);
5 const feedUrl = url.searchParams.get("url");

getRandomNumbermain.tsx1 match

@xxxlovecola•Updated 7 months ago
1export default async function server(request: Request): Promise<Response> {
2 const url = new URL(request.url);
3 const min = parseInt(url.searchParams.get("min") || "2");

getFileEmail4 file matches

@shouser•Updated 1 month ago
A helper function to build a file's email
tuna

tuna8 file matches

@jxnblk•Updated 1 month ago
Simple functional CSS library for Val Town
lost1991
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": "*",
webup
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.