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=fetch&page=756&format=json

For typeahead suggestions, use the /typeahead endpoint:

https://codesearch.val.run/typeahead?q=fetch

Returns an array of strings in format "username" or "username/projectName"

Found 8442 results for "fetch"(1153ms)

getRandomPokemonmain.tsx2 matches

@gabby•Updated 1 year ago
1import { fetchData } from "https://esm.town/v/gabby/fetchData";
2
3export let getRandomPokemon = async () => {
4 const id = Math.floor(Math.random() * 151);
5 const url = `https://pokeapi.co/api/v2/pokemon/${id}`;
6 const data = await fetchData(url);
7 console.log(data.name);
8};

nasaAPODmain.tsx2 matches

@baiheinet•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3// Returns NASA's Astronomy Picture of the Day (APOD)
4export const nasaAPOD = fetchJSON("cutt.ly/T7ksirK");
5// Forked from @iBrokeit.nasaAPOD

fetchHeaders2main.tsx3 matches

@mrahnis•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export let fetchHeaders2 = Object.fromEntries(
4 (await fetch("https://coast.noaa.gov/htdata/lidar1_z/")).headers.entries(),
5);

congressmain.tsx2 matches

@devdoshi•Updated 1 year ago
1import { email } from "https://esm.town/v/std/email?v=9";
2import { fetchCongressTradeReports } from "https://esm.town/v/claytn/fetchCongressTradeReports?v=3";
3
4export async function congress() {
5 let text;
6 fetchCongressTradeReports((reports) => text = reports);
7 if (text)
8 await email({ text, subject: "Congress" });

getSofZmanShmamain.tsx2 matches

@shaya•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export async function getSofZmanShma(city) {
5 const today = new Date().toISOString().split("T")[0];
6 const data = await (
7 await fetch(
8 `https://www.hebcal.com/zmanim?cfg=json&city=${city}&date=${today}`
9 )

syncCommentToLemmymain.tsx4 matches

@pdebie•Updated 1 year ago
1import { set } from "https://esm.town/v/std/set?v=11";
2import { spacexLemmyDb } from "https://esm.town/v/pdebie/spacexLemmyDb";
3import { fetchRss } from "https://esm.town/v/pdebie/fetchRss";
4
5export async function syncCommentToLemmy(
21 const { LemmyHttp } = await import("npm:lemmy-js-client@0.18.1");
22 let client = new LemmyHttp(`https://${instance}`, {
23 fetchFunction: fetch,
24 });
25 // (client as any)["#fetchFunction"] = fetch;
26 let comments = (await fetchRss(redditUrl)).filter((i) =>
27 new Date(i.isoDate) >= new Date(Date.now() - 1000 * 60 * 60 * 24)
28 )

convertTodoItemsToGamePlansmain.tsx2 matches

@thomasatflexos•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2import process from "node:process";
3
43 redirect: "follow",
44 };
45 let openApiResponse = await fetch(
46 "https://api.openai.com/v1/chat/completions",
47 requestOptions,

fetchHtmlDommain.tsx3 matches

@aeaton•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export async function fetchHtmlDom(url: string) {
4 const { DOMParser } = await import(
5 "https://deno.land/x/deno_dom/deno-dom-wasm.ts"
6 );
7 const response = await fetch(url);
8 const html = await response.text();
9 const parser = new DOMParser();

githubFollowingmain.tsx2 matches

@alexmcroberts•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3// Github following
4export let githubFollowing = fetchJSON(
5 "https://api.github.com/users/stevekrouse/following"
6);

nearestOpenStationmain.tsx3 matches

@guscuddy•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export const nearestOpenStation = async ({ lon, lat }) => {
9 );
10 }
11 const { data: { stations: stationInfo } } = await fetch(
12 "https://gbfs.citibikenyc.com/gbfs/en/station_status.json",
13 ).then((r) => r.json());
15 stationInfo.map((info) => [info.station_id, info]),
16 );
17 const { data: { stations } } = await fetch(
18 "https://gbfs.citibikenyc.com/gbfs/en/station_information.json",
19 ).then((r) => r.json());

fetchPaginatedData2 file matches

@nbbaier•Updated 2 weeks ago

FetchBasic1 file match

@fredmoon•Updated 2 weeks ago