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/image-url.jpg%20%22Image%20title%22?q=function&page=2155&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 22790 results for "function"(1318ms)

myApimain.tsx1 match

@benfwalla•Updated 1 year ago
1export function myApi(name) {
2 var sentence = "hi " + name;
3 console.email(sentence);

kelvinToCelciusmain.tsx1 match

@mutludev_•Updated 1 year ago
1export function kelvinToCelcius(kelvin) {
2 return kelvin - 273.15;
3}

myApimain.tsx1 match

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

getAvailableCoursesmain.tsx1 match

@usefulthink•Updated 1 year ago
2import { parseBlock } from "https://esm.town/v/usefulthink/parseBlock";
3
4export async function getAvailableCourses() {
5 const JSDOM = await import("npm:jsdom");
6 const qs = await import("node:querystring");

msToIsoDatemain.tsx1 match

@rwev•Updated 1 year ago
1export function msToIsoDate(unixMs) {
2 return new Date(unixMs).toISOString().split("T")[0];
3}

myApimain.tsx1 match

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

displayGuestBookmain.tsx1 match

@wesbos•Updated 1 year ago
2import { guestCount } from "https://esm.town/v/wesbos/guestCount";
3
4export function displayGuestBook(req: express.Request, res: express.Response) {
5 const message = req.query.message?.slice(0, 15);
6 guestCount++;

githubNotificationsmain.tsx1 match

@pomdtr•Updated 1 year ago
2import process from "node:process";
3
4export async function githubNotifications() {
5 const res = await fetch("https://api.github.com/notifications?all=true", {
6 headers: {

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)

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.