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/?q=function&page=818&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 8322 results for "function"(498ms)

testReceivemain.tsx1 match

@stevekrouse•Updated 1 year ago
1export function testReceive(req, res) {
2 res.send("ok");
3}

handleFormExamplemain.tsx1 match

@stevekrouse•Updated 1 year ago
2import { email } from "https://esm.town/v/std/email?v=9";
3
4export async function handleFormExample(req, res) {
5 await email({
6 text: JSON.stringify(req.query, null, 2),

nakedAPIExmain.tsx1 match

@stevekrouse•Updated 1 year ago
1export function nakedAPIEx(req, res) {
2 res.send("my returned srting");
3}

runValmain.tsx1 match

@std•Updated 1 year ago
2import { API_URL } from "https://esm.town/v/std/API_URL";
3
4export function runVal(name, ...args) {
5 return fetch(`${API_URL}/v1/run/${name.replace("@", "")}`, {
6 method: "POST",

hmain.tsx3 matches

@tmcw•Updated 1 year ago
1import { h as h2 } from "https://esm.town/v/tmcw/h";
2
3export function h(tagName: string, attrsPlus?: any, ...children: any[]) {
4 if (!attrsPlus) attrsPlus = {};
5 if (attrsPlus.isEl || typeof attrsPlus === "string")
28 .join("");
29 const attrsToEmit = Object.entries(attrsPlus).reduce((acc: any, [k, v]) => {
30 if (k.startsWith("on") && typeof v === "function") return acc; // Skip events
31 if (v === null || v === undefined) return acc; // Skip null/undefined
32 if (typeof v === "function") v = v(); // Allow dynamic stuff (continue to rest of function)
33 if (k === "innerHTML") innerHtml = String(v);
34 else if (k === "innerText") innerHtml = text2Html(String(v));

isValTownTeammain.tsx1 match

@stevekrouse•Updated 1 year ago
1import { valTownTeam } from "https://esm.town/v/stevekrouse/valTownTeam";
2
3export function isValTownTeam(handle) {
4 return valTownTeam.includes(handle.replace("@", ""));
5}

valTownBlogJSONmain.tsx1 match

@stevekrouse•Updated 1 year ago
1import { fetchText } from "https://esm.town/v/stevekrouse/fetchText";
2
3export async function valTownBlogJSON(): Promise<Blog[]> {
4 let { parse } = await import("npm:node-html-parser");
5 const text = await fetchText("https://blog.val.town");

jsJamHTMLmain.tsx1 match

@stevekrouse•Updated 1 year ago
1import { jsJamMessages } from "https://esm.town/v/stevekrouse/jsJamMessages";
2
3export function jsJamHTML(req, res) {
4 res.send(`<h1>${JSON.stringify(jsJamMessages)}</h1>`);
5}

serverlessMatrixEchoBotmain.tsx1 match

@stevekrouse•Updated 1 year ago
1// https://stevekrouse-serverlessMatrixEchoBot.express.val.run/_matrix/push/v1/notify
2export async function serverlessMatrixEchoBot(req, res) {
3 res.send(req.path);
4}

rimeRateLimitExceededmain.tsx1 match

@stevekrouse•Updated 1 year ago
2import { rimeUsage } from "https://esm.town/v/stevekrouse/rimeUsage";
3
4export function rimeRateLimitExceeded(text: string) {
5 rimeUsage[new Date().toLocaleDateString()] =
6 (rimeUsage[new Date().toLocaleDateString()] || 0) +

getFileEmail4 file matches

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

TwilioHelperFunctions

@vawogbemi•Updated 2 months ago