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=775&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 7804 results for "function"(1532ms)

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));

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}

questionmain.tsx1 match

@tmcw•Updated 1 year ago
1export function question() {
2 return "hello";
3}

measureValTownE2emain.tsx1 match

@tmcw•Updated 1 year ago
28
29 console.log(
30 `average e2e user function time: ${(
31 userFuncTimes.reduce((a, b) => a + b, 0) / count
32 ).toFixed(0)}ms (fastest was ${userFuncTimes

doublemain.tsx1 match

@stevekrouse•Updated 1 year ago
1export function double(x: number) {
2 return 2 * x;
3}

pollmain.tsx2 matches

@tmcw•Updated 1 year ago
21`;
22 const formClass = "p-2 group min-h-screen animate-all bg-pink-50";
23 function parseCookies(cookie: string) {
24 const out: Record<string, string> = {};
25 const c = cookie.split(";");
31 return out;
32 }
33 function getResults(hasVoted: boolean) {
34 return html`<html>
35 ${head}

twitterAPIDownAlertmain.tsx1 match

@stevekrouse•Updated 1 year ago
1import { twitterAPIDown } from "https://esm.town/v/stevekrouse/twitterAPIDown";
2
3export async function twitterAPIDownAlert() {
4 if (twitterAPIDown.down)
5 console.email(

hnFollowPollJobErrormain.tsx1 match

@stevekrouse•Updated 1 year ago
3import { hnLatestPosts } from "https://esm.town/v/stevekrouse/hnLatestPosts";
4
5export async function hnFollowPollJobError({ lastRunAt }: Interval) {
6 try {
7 let posts = await hnLatestPosts({

pollRSSFeedsmain.tsx1 match

@tmcw•Updated 1 year ago
1import { newRSSItems } from "https://esm.town/v/stevekrouse/newRSSItems?v=6";
2
3export async function pollRSSFeeds() {
4 return Object.entries({
5 mine: "https://macwright.com/rss.xml",

exampleAuthApimain.tsx1 match

@stevekrouse•Updated 1 year ago
3import { verifyAPIAuth } from "https://esm.town/v/stevekrouse/verifyAPIAuth";
4
5export async function exampleAuthApi(arg1, arg2, auth) {
6 let { handle } = await verifyAPIAuth(auth);
7 if (handle) {

getFileEmail4 file matches

@shouser•Updated 6 days ago
A helper function to build a file's email

TwilioHelperFunctions

@vawogbemi•Updated 2 months ago