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=2415&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 25288 results for "function"(2953ms)

Foodmain.tsx1 match

@adamgonda•Updated 1 year ago
1export function Food(x, y) {
2 return { x, y };
3}

hueRotatemain.tsx1 match

@pasquale•Updated 1 year ago
1export function hueRotate() {
2 // Generate a random number between 0 and 180
3 let randomNumber = Math.floor(Math.random() * 181);

handlermain.tsx1 match

@thesophiaxu•Updated 1 year ago
1export async function handler(req, res) {
2 console.email(JSON.stringify(req.body, null, 4), "Hello from Val.town!");
3}

parsePdfDatamain.tsx1 match

@speepo•Updated 1 year ago
1// NOT FUNCTIONAL
2// THE PDF LIBRARY PROBABLY WON'T WORK WITH THE CODE AS IT IS
3export const parsePdfData = (req: express.Request, res: express.Response) => {

artICGetRandommain.tsx1 match

@wilt•Updated 1 year ago
20 boost: false,
21 query: {
22 function_score: {
23 query: {
24 bool: {

hellomain.tsx1 match

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

getArgsmain.tsx1 match

@sdan•Updated 1 year ago
1import { extractValArgs } from "https://esm.town/v/sdan/extractValArgs";
2
3export async function getArgs(valName: string) {
4 const rep = await extractValArgs(valName);
5 return rep;

projmain.tsx1 match

@tmcw•Updated 1 year ago
1export function proj(ll: Pos2): Pos2 {
2 // Arbitrary.
3 const D2R = Math.PI / 180;

untitled_mutate_test_statemain.tsx1 match

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

openaiOpenAPImain.tsx8 matches

@stevekrouse•Updated 1 year ago
4 title: Val Town API
5 description: |
6 The Val Town API provides services to evaluate JavaScript and TypeScript expressions, run vals as APIs, either as functions or Express handlers.
7
8 Learn more at [https://docs.val.town](https://docs.val.town)
35 description: |
36 The JavaScript or TypeScript expression to be evaluated.
37 This should be a single expression, like a single function
38 call, assignment operation, or calculation. If you need
39 to execute multiple expressions, wrap them in a function.
40 schema:
41 type: string
44 value: "1+1"
45 summary: Simple addition
46 functionCall:
47 value: "@stevekrouse.addOne(@stevekrouse.example1)"
48 summary: Calling a user's val function
49 handle:
50 name: handle
71 summary: "id"
72 description: |
73 This val is a function that returns its arguments. It is useful for testing how the API handles the arguments passed to it.
74
75 View the val at [https://val.town/v/stevekrouse.id](https://val.town/v/stevekrouse.id)
92 value: 2
93 summary: Simple addition result
94 functionCall:
95 value: 42
96 summary: Calling a function result
97
98security:

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.