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=2677&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 29089 results for "function"(1778ms)

val_town_by_example_componentsmain.tsx4 matches

@pomdtr•Updated 1 year ago
3import { TocGroup, TocItem } from "https://esm.town/v/pomdtr/val_town_by_example_toc";
4
5export function IndexItem(props: { item: TocItem }) {
6 return (
7 <li>
17}
18
19export function IndexGroup(props: { group: TocGroup }) {
20 return (
21 <li class="md:w-1/4">
30}
31
32export function Example({ example }: { example: Example }) {
33 return (
34 <div>
96}
97
98export function Snippet(props: {
99 firstOfFile: boolean;
100 lastOfFile: boolean;

notifyHackerNewsRepliesmain.tsx1 match

@chet•Updated 1 year ago
6const username = "ccorcos";
7
8export default async function(interval: Interval) {
9 const url = "https://news.ycombinator.com/threads?id=" + username;
10 const html = await fetchText(url);

dependenciesmain.tsx2 matches

@pomdtr•Updated 1 year ago
6};
7
8export function extractDependencies(code: string) {
9 const esmUrlRegex = /https:\/\/esm\.town\/v\/([a-zA-Z_$][0-9a-zA-Z_$]*)\/([a-zA-Z_$][0-9a-zA-Z_$]*)/g;
10
21}
22
23export async function searchReferences(val: ValRef) {
24 const esmUrl = `https://esm.town/v/${val.author}/${val.name}`;
25 const { data: vals } = await api(`/v1/search/vals?query=${encodeURIComponent(esmUrl)}`, {

openaiFineTuneDatamain.tsx1 match

@stevekrouse•Updated 1 year ago
3import { openaiUploadFile } from "https://esm.town/v/stevekrouse/openaiUploadFile?v=15";
4
5export async function openaiFineTuneData({ key, data, model }: {
6 key: string;
7 data: any;

openaiUploadFilemain.tsx1 match

@stevekrouse•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export async function openaiUploadFile({ key, data, purpose = "assistants" }: {
4 key: string;
5 data: any;

val_town_by_example_parsemain.tsx2 matches

@pomdtr•Updated 1 year ago
26}
27
28export function extractSnippets(content: string): ExampleSnippet[] {
29 // Separate the code into snippets.
30 const snippets: ExampleSnippet[] = [];
86}
87
88export async function parseExample(author: string, name: string): Promise<Example> {
89 let { code } = await api<{ code: string }>(`/v1/alias/${author}/${name}`);
90 // Substitute $std/ with the full import url

BlueCardChangeDetectormain.tsx1 match

@wilhelm•Updated 1 year ago
6const dateChangedKey = "work-permit-change-date";
7
8export default async function(interval: Interval) {
9 const page = await fetch(site).then(res => res.text());
10 const date = page.match(/Last updated: <time datetime="([^"]+)">/)?.[1].toString();

apimain.tsx1 match

@pomdtr•Updated 1 year ago
1import { API_URL } from "https://esm.town/v/std/API_URL";
2
3export async function api<T = any>(
4 path: string,
5 options?: RequestInit & {

discordEventReceivermain.tsx1 match

@neverstew•Updated 1 year ago
1export default async function handler(req: Request) {
2 console.log(await req.json());
3 return Response.json({ ok: true });

apimain.tsx1 match

@zeroftdev•Updated 1 year ago
1import { API_URL } from "https://esm.town/v/std/API_URL";
2
3export async function api<T = any>(
4 path: string,
5 options?: RequestInit & {
tuna

tuna9 file matches

@jxnblk•Updated 23 hours ago
Simple functional CSS library for Val Town

getFileEmail4 file matches

@shouser•Updated 1 month ago
A helper function to build a file's email
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.