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=703&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 7168 results for "function"(547ms)

feedbackmain.ts1 match

@pomdtr•Updated 2 months ago
1import { gfm } from "https://esm.town/v/pomdtr/gfm";
2
3export default async function(req: Request): Promise<Response> {
4 const markdown = await fetch(import.meta.resolve("./README.md")).then(res => res.text());
5 const url = new URL(req.url);

APIBuilderTemplateenthusiasticPeachTapir1 match

@dcm31•Updated 2 months ago
1export default async function (interval: Interval) {
2
3}

spotifyOauthServergetSpotifyToken1 match

@charmaine•Updated 2 months ago
1import { getRow, getLatestRefreshRow, updateRow } from"./db";
2
3export async function getSpotifyToken(state: string) {
4 const authData = await getRow(state);
5 if (!authData) throw "NO_DATA";

spotifyOauthServergetSpotifyToken1 match

@neverstew•Updated 2 months ago
1import { getRow, getLatestRefreshRow, updateRow } from"./db";
2
3export async function getSpotifyToken(state: string) {
4 const authData = await getRow(state);
5 if (!authData) throw "NO_DATA";

loggingTesthelperFunction2 matches

@willthereader•Updated 2 months ago
1export function squareNumber(num: number) {
2 console.log("helper function log");
3 console.log(`Squaring number: ${num}`);
4 return num * num;

loggingTestmainFunction3 matches

@willthereader•Updated 2 months ago
1import { squareNumber } from "./helperFunction";
2
3function processMathList() {
4 console.log("Starting math processing");
5 const numbers = [1, 2, 3];
7}
8
9console.log("\nTesting Math Functions:");
10console.log(processMathList());

vblogimport-file1 match

@jxnblk•Updated 2 months ago
1/** Import a file relative to the root of the project */
2export async function importFile(path: string) {
3 const url = new URL(path, import.meta.url);
4 const res = await fetch(url, { redirect: "follow" });

BraintrustSDKtutorial1 match

@stevekrouse•Updated 2 months ago
3import { Eval } from "npm:braintrust";
4
5export default async function handler() {
6 const result = {
7 apiKeyStatus: null,

queueparseImportMeta1 match

@maxm•Updated 2 months ago
7}
8
9export function parseImportMeta(url: string): ImportMetaUrl {
10 const pattern = /^https:\/\/esm\.town\/v\/([^/]+)\/([^@]+)@(\d+)-(.+?)(\/.*)?$/;
11 const match = url.match(pattern);

fortuitousVioletLeopardadmirableGreenMink1 match

@charmaine•Updated 2 months ago
1export default async function (req: Request): Promise<Response> {
2 return Response.json({ ok: true })
3}

getFileEmail4 file matches

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

TwilioHelperFunctions

@vawogbemi•Updated 2 months ago