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=1548&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 18129 results for "function"(3154ms)

getWeathermain.tsx1 match

@richardkaplan•Updated 11 months ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2
3export async function getWeather(location: string): Promise<WeatherResponse> {
4 return fetchJSON(`https://wttr.in/${location}?format=j1`);
5}

UserWidgetsmain.tsx1 match

@iamseeley•Updated 11 months ago
18}
19
20export default function UserWidgets({ user }: UserWidgetsProps) {
21 return (
22 <div>

forwardermain.tsx1 match

@richardkaplan•Updated 11 months ago
1import { email } from "https://esm.town/v/std/email?v=11";
2
3export function forwarder(e: {
4 from: string;
5 to: string[];

blobImagesmain.tsx1 match

@jdan•Updated 11 months ago
7import { Hono } from "npm:hono@3";
8
9function esmTown(url) {
10 return fetch(url, {
11 headers: {

stockPricemain.tsx4 matches

@stevekrouse•Updated 11 months ago
2import { thisWebURL } from "https://esm.town/v/stevekrouse/thisWebURL";
3
4async function alphaVantage(symbol: string) {
5 let data = await fetchJSON(
6 `https://www.alphavantage.co/query?function=GLOBAL_QUOTE&symbol=${symbol}&apikey=${Deno.env.get("alphaVantage")}`,
7 );
8 return data;
9}
10
11export function getStockData(symbol: string) {
12 return fetchJSON(
13 `${thisWebURL()}?symbol=${symbol}`,
15}
16
17export function getStockPrice(symbol: string) {
18 return getStockData(symbol).then((data) => data["Global Quote"]["05. price"]);
19}

blobImagesmain.tsx1 match

@stevekrouse•Updated 11 months ago
7import { Hono } from "npm:hono@3";
8
9function esmTown(url) {
10 return fetch(url, {
11 headers: {

uploadImagemain.tsx2 matches

@easrng•Updated 11 months ago
4 * @returns {string} - uploaded image url
5 */
6export async function uploadImage(image: Blob): Promise<string> {
7 const fd = new FormData();
8 fd.append(
23 return data.result.variants[0];
24}
25async function getUploadURL(): Promise<string> {
26 const data = await (await fetch("https://www.val.town/api/trpc/generateImageUploadUrl", {
27 "headers": {

grayLimpetmain.tsx1 match

@samk•Updated 11 months ago
4import { currency } from "https://esm.town/v/stevekrouse/currency";
5
6export async function btcPriceAlert() {
7 const lastBtcPrice: number = await blob.getJSON("lastBtcPrice");
8 let btcPrice = await currency("usd", "btc");

currencymain.tsx1 match

@stevekrouse•Updated 11 months ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3function fetchJSON(url) {
4 return fetch(url).then(res => res.json());
5}

btcPriceAlertmain.tsx1 match

@samk•Updated 11 months ago
4import { currency } from "https://esm.town/v/stevekrouse/currency";
5
6export async function btcPriceAlert() {
7 const lastBtcPrice: number = await blob.getJSON("lastBtcPrice");
8 let btcPrice = await currency("usd", "eth");

getFileEmail4 file matches

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

tuna8 file matches

@jxnblk•Updated 2 weeks ago
Simple functional CSS library for Val Town
webup
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.
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": "*",