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=2720&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 28430 results for "function"(3259ms)

extractArgsmain.tsx10 matches

@pomdtr•Updated 1 year ago
1export async function extractArgs(code: string) {
2 const { default: ts } = await import("npm:typescript");
3 // Create a source file from the code string
7 ts.ScriptTarget.Latest,
8 );
9 // Traverse the abstract syntax tree (AST) to find the function declaration
10 function findFunctionDeclaration(
11 node: ts.Node,
12 ): ts.FunctionDeclaration | undefined {
13 if (ts.isFunctionDeclaration(node)) {
14 return node;
15 }
16 return node.forEachChild(findFunctionDeclaration);
17 }
18 // Find the function declaration
19 const functionDeclaration = findFunctionDeclaration(sourceFile);
20 if (!functionDeclaration) {
21 return null;
22 }
23 // Extract argument names and types
24 return functionDeclaration.parameters.map((param) => ({
25 name: code.slice(param.name.pos, param.name.end).trim(),
26 type: param.type

nearestOpenStationmain.tsx1 match

@johnmuyskens•Updated 1 year ago
5 lon = +lon;
6 lat = +lat;
7 function dist(station) {
8 return Math.sqrt(
9 Math.pow(station.lat - lat, 2) + Math.pow(station.lon - lon, 2)

alphaVantageSymbolSearchmain.tsx1 match

@sean•Updated 1 year ago
12 const queryString = await toQueryString({
13 ...options,
14 function: "SYMBOL_SEARCH",
15 });
16

myApimain.tsx1 match

@codingjlu•Updated 1 year ago
1export function myApi(name) {
2 return "hi " + name;
3}

myApimain.tsx1 match

@stordahl•Updated 1 year ago
1export function myApi(name) {
2 return "hi " + name;
3}

myApimain.tsx1 match

@cihad•Updated 1 year ago
1export function myApi(name) {
2 return "hi " + name;
3}

subscribemain.tsx1 match

@eric•Updated 1 year ago
3import { getEmails } from "https://esm.town/v/eric/getEmails";
4
5export function subscribe() {
6 const s = getEmails()
7 console.log(s)

oneifymain.tsx1 match

@eric•Updated 1 year ago
1let { definitelynotnull } = await import("https://esm.town/v/eric/definitelynotnull");
2
3export function oneify() {
4 return definitelynotnull = 1
5}

untitled6372775main.tsx1 match

@eric•Updated 1 year ago
3import { getEmails } from "https://esm.town/v/eric/getEmails";
4
5untitled6372775 = export async function subscribe() {
6 const s = await getEmails()
7 console.log(s)

myApimain.tsx1 match

@carsonwack•Updated 1 year ago
1export function myApi(name) {
2 return "hi " + name;
3}

getFileEmail4 file matches

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

tuna8 file matches

@jxnblk•Updated 1 month ago
Simple functional CSS library for Val Town
lost1991
import { OpenAI } from "https://esm.town/v/std/openai"; export default async function(req: Request): Promise<Response> { if (req.method === "OPTIONS") { return new Response(null, { headers: { "Access-Control-Allow-Origin": "*",
webup
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.