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/$1?q=function&page=2379&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 28557 results for "function"(7713ms)

val_dDDB0hjTShmain.tsx4 matches

@dhvanil•Updated 6 months ago
1
2 export async function val_dDDB0hjTSh(req) {
3 try {
4 // Ensure request body is consumed
5 const body = await req.text();
6
7 // Create a function from the provided code and execute it
8 const userFunction = async () => {
9 const findPrimes = (n) => {
10 const primes = [];
28
29 // Execute and capture the result
30 const result = await userFunction();
31
32 // Handle different types of results

val_h71QOVqMsfmain.tsx4 matches

@dhvanil•Updated 6 months ago
1
2 export async function val_h71QOVqMsf(req) {
3 try {
4 // Ensure request body is consumed
5 const body = await req.text();
6
7 // Create a function from the provided code and execute it
8 const userFunction = async () => {
9 const findPrimes = (n) => {
10 const primes = [];
28
29 // Execute and capture the result
30 const result = await userFunction();
31
32 // Handle different types of results

val_P5Jos9W9mMmain.tsx4 matches

@dhvanil•Updated 6 months ago
1
2 export async function val_P5Jos9W9mM(req) {
3 try {
4 // Ensure request body is consumed
5 const body = await req.text();
6
7 // Create a function from the provided code and execute it
8 const userFunction = async () => {
9 const findPrimes = (n) => {
10 const primes = [];
28
29 // Execute and capture the result
30 const result = await userFunction();
31
32 // Handle different types of results

val_5OBYpMAcsJmain.tsx4 matches

@dhvanil•Updated 6 months ago
1
2 export async function val_5OBYpMAcsJ(req) {
3 try {
4 // Ensure request body is consumed
5 const body = await req.text();
6
7 // Create a function from the provided code and execute it
8 const userFunction = async () => {
9 const findPrimes = (n) => {
10 const primes = [];
28
29 // Execute and capture the result
30 const result = await userFunction();
31
32 // Handle different types of results

val_QNCsjRvGfnmain.tsx5 matches

@dhvanil•Updated 6 months ago
1
2 export async function val_QNCsjRvGfn(req) {
3 try {
4 // Ensure request body is consumed
5 const body = await req.text();
6
7 // Create a function from the provided code and execute it
8 const userFunction = async () => {
9 function findPrimes(limit) { const primes = []; for (let num = 2; num < limit; num++) { let isPrime = true; for (let i = 2; i <= Math.sqrt(num); i++) { if (num % i === 0) { isPrime = false; break; } } if (isPrime) { primes.push(num); } } return primes; } findPrimes(10);
10 };
11
12 // Execute and capture the result
13 const result = await userFunction();
14
15 // Handle different types of results

val_8NcFl97iehmain.tsx4 matches

@dhvanil•Updated 6 months ago
1
2 export async function val_8NcFl97ieh(req) {
3 try {
4 // Ensure request body is consumed
5 const body = await req.text();
6
7 // Create a function from the provided code and execute it
8 const userFunction = async () => {
9 const findPrimes = (n) => {
10 const primes = [];
28
29 // Execute and capture the result
30 const result = await userFunction();
31
32 // Handle different types of results

val_9dy3yd3x6Amain.tsx4 matches

@dhvanil•Updated 6 months ago
1
2 export async function val_9dy3yd3x6A(req) {
3 try {
4 // Ensure request body is consumed
5 const body = await req.text();
6
7 // Create a function from the provided code and execute it
8 const userFunction = async () => {
9 const findPrimes = (n) => {
10 const primes = [];
28
29 // Execute and capture the result
30 const result = await userFunction();
31
32 // Handle different types of results

val_4Etu5C04olmain.tsx4 matches

@dhvanil•Updated 6 months ago
1
2 export async function val_4Etu5C04ol(req) {
3 try {
4 // Ensure request body is consumed
5 const body = await req.text();
6
7 // Create a function from the provided code and execute it
8 const userFunction = async () => {
9 const findPrimes = (n) => {
10 const primes = [];
28
29 // Execute and capture the result
30 const result = await userFunction();
31
32 // Handle different types of results

val_80sL9x3ODxmain.tsx4 matches

@dhvanil•Updated 6 months ago
1
2 export async function val_80sL9x3ODx(req) {
3 try {
4 // Ensure request body is consumed
5 const body = await req.text();
6
7 // Create a function from the provided code and execute it
8 const userFunction = async () => {
9 const findPrimes = (n) => {
10 const primes = [];
28
29 // Execute and capture the result
30 const result = await userFunction();
31
32 // Handle different types of results

tokencountermain.tsx6 matches

@prashamtrivedi•Updated 6 months ago
4import { createRoot } from "https://esm.sh/react-dom/client";
5
6function App() {
7 const [systemPrompt, setSystemPrompt] = useState("");
8 const [userPrompt, setUserPrompt] = useState("");
25 };
26
27 const handleApiKeyChange = (e, setFunction, storageKey) => {
28 const value = e.target.value;
29 setFunction(value);
30 saveApiKey(storageKey, value);
31 };
69 try {
70 const parsedTools = JSON.parse(tools);
71 modelOptions.functionDeclarations = parsedTools;
72 } catch (error) {
73 console.error("Error parsing tools JSON for Gemini:", error);
217}
218
219function client() {
220 createRoot(document.getElementById("root")).render(<App />);
221}
222if (typeof document !== "undefined") { client(); }
223
224export default async function server(request: Request): Promise<Response> {
225 const url = new URL(request.url);
226

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.