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=815&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 8323 results for "function"(459ms)

valTownStyleGuideUpdatedmain.tsx1 match

@stevekrouse•Updated 1 year ago
2import { hasValTownStyleGuideUpdated } from "https://esm.town/v/stevekrouse/hasValTownStyleGuideUpdated";
3
4export async function valTownStyleGuideUpdated({ lastRunAt }) {
5 if (await hasValTownStyleGuideUpdated(lastRunAt))
6 email({

githubNormalizedJsonStringmain.tsx1 match

@stevekrouse•Updated 1 year ago
1export function githubNormalizedJsonString(payload: object) {
2 // GitHub sends its JSON with an indentation of 2 spaces and a line break at the end
3 const payloadString = JSON.stringify(payload, null, 2) + "\n";

timedmain.tsx1 match

@stevekrouse•Updated 1 year ago
1// Times how long an execution takes
2// usage: @stevekrouse.panphoraDistanceTimed
3export async function timed(f) {
4 const start = Date.now();
5 const res = await f();

measureValTownE2emain.tsx1 match

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

addmain.tsx1 match

@stevekrouse•Updated 1 year ago
1export function add(...args) {
2 return args.reduce((a, b) => a + b, 0);
3}

dmmain.tsx1 match

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

weatherGovGridmain.tsx1 match

@stevekrouse•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2
3export function weatherGovGrid({ lat, lon }): Promise<WeatherData> {
4 return fetchJSON(
5 `https://api.weather.gov/points/${lat},${lon}`,

r2main.tsx1 match

@stevekrouse•Updated 1 year ago
3import { whoami } from "https://esm.town/v/stevekrouse/whoami";
4
5export async function r2(key, value?, keys?) {
6 // GET
7 if (value === undefined) {

runAllTests2main.tsx1 match

@stevekrouse•Updated 1 year ago
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
3
4export async function runAllTests2({ names }: { names: string[] }) {
5 return names.map((name) =>
6 fetchJSON(`${TEST_API}/eval/@stevekrouse.${name}()`)

discordMessagesmain.tsx1 match

@stevekrouse•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2
3export function discordMessages({ botToken, channelId }) {
4 return fetchJSON(
5 `https://discord.com/api/channels/${channelId}/messages`,

getFileEmail4 file matches

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

TwilioHelperFunctions

@vawogbemi•Updated 2 months ago