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/$%7Burl%7D?q=function&page=1749&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 19423 results for "function"(3736ms)

ssrmain.tsx1 match

@pomdtr•Updated 1 year ago
15export type Action = (req: Request, ctx: Context) => Response | Promise<Response>;
16
17export function handler(Component, action?: Action) {
18 return async (c) => {
19 if (action) {

hashmain.tsx1 match

@postpostscript•Updated 1 year ago
1export type ShaAlgorithm = "SHA-256" | "SHA-512";
2
3export async function sha(
4 input: string | BufferSource | AsyncIterable<BufferSource> | Iterable<BufferSource>,
5 algo: ShaAlgorithm = "SHA-256",

midnightpubFeedmain.tsx2 matches

@vladimyr•Updated 1 year ago
8const reUserFeed = /^\/(?<username>~[a-z0-9-_]+)\.(?<format>atom|rss)$/;
9
10export default async function(req: Request): Promise<Response> {
11 const { pathname } = new URL(req.url);
12 const match = pathname.match(reUserFeed);
49}
50
51async function grabPosts(profileURL: string | URL) {
52 const html = await ky.get(profileURL).text();
53 const doc = new DOMParser().parseFromString(html, "text/html");

testmain.tsx1 match

@postpostscript•Updated 1 year ago
23}
24
25export function testContext<TOptions extends TestContextOptions>(options: TOptions) {
26 const tests: Test<TOptions>[] = [];
27

createValFromCljsmain.tsx1 match

@liamdanielduffy•Updated 1 year ago
2import { updateValByName } from "https://esm.town/v/nbbaier/updateValByName";
3
4export async function createValFromCljs(name: string, cljs: string) {
5 return updateValByName({
6 token: Deno.env.get("valtown"),

compileCljsToES6main.tsx1 match

@liamdanielduffy•Updated 1 year ago
4globalThis.squint_core = squint_core;
5
6export function compileCljsToES6(cljs: string) {
7 return compileString(cljs, { repl: true, "elide-exports": true }).replace(
8 "squint-cljs",

vueREADME.md1 match

@postpostscript•Updated 1 year ago
7import { vueSfcInline } from "https://esm.town/v/postpostscript/vue";
8
9export default function() {
10 return htmlResponse`
11 ${vueSfcInline`

multiFormatmain.tsx14 matches

@postpostscript•Updated 1 year ago
1import { html, RawHTML } from "https://esm.town/v/postpostscript/html";
2
3export function multiFormat<R extends MultiFormat = { text: string }>(
4 strings: TemplateStringsArray,
5 ...replacements: (string | R)[]
31};
32
33export function combineMultiFormat<R extends MultiFormat>(
34 values: (R | string)[],
35 transformers = DEFAULT_TRANSFORMERS as Transformers<R>,
67}
68
69export function joinMultiFormat<R extends MultiFormat>(values: (R | string)[], join: R | string) {
70 if (!values.length) {
71 return {
84}
85
86export function normalizeMultiFormat<R extends MultiFormat>(value: R | string | number | boolean | null | undefined) {
87 if (isString(value)) {
88 return { text: value };
94}
95
96export function getMultiFormatValue<R extends MultiFormat, K extends keyof R>(
97 value: R,
98 key: K,
110}
111
112function isString(value: unknown): value is string {
113 return typeof value === "string" || value instanceof String;
114}
115
116function toString(value: unknown) {
117 if (isString(value)) {
118 return value;
124}
125
126export function addStrings(valueA: unknown, valueB: unknown) {
127 if (!(isString(valueA) && isString(valueB))) {
128 return addStrings(
141}
142
143export function wrapHTMLTag(
144 tag: string,
145 text: string | MultiFormatWithHTML,
161}
162
163export function createFormatMethod<R extends MultiFormat>(method: (value: R) => R) {
164 return (
165 strings: TemplateStringsArray,
170}
171
172export function createWrapTagFormatMethod(tag: string, attrs: Record<string, string> = {}) {
173 return createFormatMethod<MultiFormatWithHTML>((value) => {
174 return wrapHTMLTag(tag, value, attrs);
197});
198
199export function ListItem(item: string | MultiFormatWithHTML, i: number | undefined = undefined) {
200 return combineMultiFormat([
201 {
213}
214
215export function OrderedList(items: (string | MultiFormatWithHTML)[]) {
216 return joinMultiFormat([
217 {
233}
234
235export function UnorderedList(items: (string | MultiFormatWithHTML)[]) {
236 return joinMultiFormat([
237 {

submitPRmain.tsx1 match

@nbbaier•Updated 1 year ago
2type PR = Parameters<typeof Octokit["rest"]["pulls"]["create"]>;
3
4export async function submitPR(ghToken: string, ...pr: PR) {
5 return new Octokit({ auth: ghToken }).rest.pulls.create(pr);
6}

githubRestClientmain.tsx1 match

@neverstew•Updated 1 year ago
1import { Octokit } from "npm:@octokit/rest";
2
3export async function githubRestClient(ghToken: string | undefined) {
4 return new Octokit({ auth: ghToken || Deno.env.get("GITHUB_TOKEN") }).rest;
5}

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.