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/$%7Bart_info.art.src%7D?q=function&page=1599&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 19450 results for "function"(3030ms)

httpHandlerOKmain.tsx1 match

@kora•Updated 9 months ago
1export function handler(request: Request) {
2 return Response.json({ ok: true });
3}

quickstartWebsitemain.tsx1 match

@kora•Updated 9 months ago
2import { renderToString } from "npm:react-dom/server";
3
4export default async function(req: Request) {
5 return new Response(
6 renderToString(

xkcdmain.tsx1 match

@loading•Updated 9 months ago
1import { parseFeed } from "jsr:@mikaelporttila/rss@*";
2
3export default async function(req: Request): Promise<Response> {
4 return new Response(
5 (await parseFeed(

gitReleaseNotesmain.tsx10 matches

@stevekrouse•Updated 9 months ago
16}
17
18// Function to fetch package info from NPM registry
19async function fetchPackageInfo(packageName: string) {
20 const url = `https://registry.npmjs.org/${packageName}`;
21 const response = await fetch(url);
26}
27
28// Function to extract GitHub repo URL from package info
29function extractGitHubRepoUrl(packageInfo: any): string | null {
30 const repository = packageInfo.repository;
31 if (repository && repository.url) {
38}
39
40// Function to get the GitHub repository path (owner/repo) from the URL
41function getGithubRepoPath(repoUrl: string): string | null {
42 const match = repoUrl.match(/github\.com\/([^\/]+\/[^\/]+)/);
43 return match ? match[1] : null;
44}
45
46async function getGithubReleases(repo: string): Promise<GithubRelease[]> {
47 const response = await fetch(`https://api.github.com/repos/${repo}/releases`);
48 if (!response.ok) {
52}
53
54function compareVersions(version1: string, version2: string): number {
55 const v1 = version1.replace(/^v/, "").split(".").map(Number);
56 const v2 = version2.replace(/^v/, "").split(".").map(Number);
63}
64
65async function getReleaseNotesBetweenVersions(repo: string, currentVersion: string): Promise<GithubRelease[]> {
66 const releases = await getGithubReleases(repo);
67
74}
75
76async function checkNpmUpdates(packageJsonUrl: string): Promise<string> {
77 try {
78 const response = await fetch(packageJsonUrl);

reacttldrawclientmain.tsx1 match

@janpaul123•Updated 9 months ago
20} = await import(ret.url + "?bundle-deps");
21
22export function App() {
23 return (
24 <>

stripHTMLmain.tsx1 match

@stevekrouse•Updated 9 months ago
1import { DOMParser } from "https://deno.land/x/deno_dom/deno-dom-wasm.ts";
2
3export function stripHTML(html: string) {
4 const doc = new DOMParser().parseFromString(html, "text/html");
5 return doc.body.textContent;

statusmain.tsx3 matches

@d17e•Updated 9 months ago
5import { renderToString } from "npm:react-dom/server";
6
7function StatusRow({ rows }) {
8 return (
9 <div className="w-full flex flex-col space-y-2">
28}
29
30function StatusSection({ url, rows }) {
31 const sectionRows = rows.filter(row => row[0] === url);
32 const percentUp = Math.round((sectionRows.filter(row => row[1]).length / sectionRows.length) * 100);
44}
45
46export default async function(req: Request): Promise<Response> {
47 const { rows } = await sqlite.execute(
48 "select url, ok, duration, timestamp from uptime order by timestamp desc limit 200",

hackerNewsRAGmain.tsx1 match

@nknj•Updated 9 months ago
53
54// Render streaming markdown
55export default async function handler(req: Request): Promise<Response> {
56 const renderMarkdown = (await import("https://esm.town/v/substrate/renderMarkdown")).default;
57 return renderMarkdown(stream);

hono_countermain.tsx1 match

@aretrace•Updated 9 months ago
3import { useState } from "https://esm.sh/hono/jsx/dom";
4
5export default function Counter(props: { initialCount?: number }) {
6 const [count, setCount] = useState(props.initialCount || 0);
7 return (

clientOnlymain.tsx1 match

@aretrace•Updated 9 months ago
2import React from 'https://esm.sh/react'
3
4export function ClientOnly({ children, ...delegated }) {
5 const [hasMounted, setHasMounted] = React.useState(false)
6 React.useEffect(() => {

getFileEmail4 file matches

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

tuna8 file matches

@jxnblk•Updated 3 weeks 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.