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=770&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"(500ms)

dateme_sqlitemain.tsx3 matches

@stevekrouse•Updated 1 year ago
4import { thisWebURL } from "https://esm.town/v/stevekrouse/thisWebURL";
5
6export function createTable() {
7 return sqlite.execute(`
8 CREATE TABLE IF NOT EXISTS DateMeDocs (
29 (:Id, :Name, :Profile, :Gender, :Age, :Contact, :LastUpdated, :InterestedIn, :Location, :Style, :LocationFlexibility, :Community)`;
30
31export default async function() {
32 let docs = await getDocs();
33 return Response.json(docs);
34}
35
36export async function setupDatabase() {
37 await createTable();
38 const docs = await fetchJSON(thisWebURL());

apricotSlothmain.tsx1 match

@tmcw•Updated 1 year ago
4
5const { result } = core.runJavascript({
6 code: "function name() { return \"Hello\"; }",
7 "name": "name",
8});

reloadOnSaveREADME.md1 match

@stevekrouse•Updated 1 year ago
9import { reloadOnSaveFetchMiddleware } from "https://esm.town/v/stevekrouse/reloadOnSave";
10
11export default reloadOnSaveFetchMiddleware(async function(req: Request): Promise<Response> {
12 return html(`<h1>Hello!!</h1>`);
13})

jsonBodyParsingmain.tsx1 match

@tmcw•Updated 1 year ago
1export default async function handler(request: Request) {
2 if (request.method !== "POST") {
3 return Response.json({ message: "This val responds to POST requests." }, {

httpMockingExamplemain.tsx1 match

@tmcw•Updated 1 year ago
4 * member.
5 */
6export const httpHandler = async function(req: Request): Promise<Response> {
7 if (req.method !== "POST") return new Response("Bad request: only POST allowed", { status: 400 });
8 const body = await req.json();

dailyStandupBotmain.tsx1 match

@stevekrouse•Updated 1 year ago
1import { discordWebhook } from "https://esm.town/v/stevekrouse/discordWebhook";
2
3export default async function() {
4 discordWebhook({
5 url: Deno.env.get("engDiscord"),

foc_contactmain.tsx1 match

@stevekrouse•Updated 1 year ago
1import { email } from "https://esm.town/v/std/email?v=11";
2
3export default async function(e: Email) {
4 email({
5 subject: "Future of Coding Message: " + e.subject,

blobCountermain.tsx1 match

@stevekrouse•Updated 1 year ago
1import { blob } from "https://esm.town/v/std/blob?v=11";
2
3export default async function(req: Request): Promise<Response> {
4 const count = (await blob.getJSON("blobCounter") ?? 0) + 1;
5 await blob.setJSON("blobCounter", count);

listSqliteTablesmain.tsx1 match

@nbbaier•Updated 1 year ago
1import { sqlite } from "https://esm.town/v/std/sqlite?v=4";
2
3export async function listSqliteTables() {
4 return (await sqlite.execute(
5 `select name from sqlite_schema where type='table' and name != 'libsql_wasm_func_table' and name != 'sqlite_sequence'`,

filterValsREADME.md1 match

@nbbaier•Updated 1 year ago
1# filterVals
2
3This val exports a utility function that returns a list of all a user's val, filtered by a callback function.
4
5## Example

getFileEmail4 file matches

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

TwilioHelperFunctions

@vawogbemi•Updated 2 months ago