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=1669&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 18617 results for "function"(6496ms)

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}

githubRestClientREADME.md1 match

@neverstew•Updated 1 year ago
1# githubRestClient
2
3Does what it says! Defaults to using `GITHUB_TOKEN` env var if none is passed to the function.
4

moduleHighlightValueLinkREADME.md1 match

@postpostscript•Updated 1 year ago
22import { getRedirectUrl } from "https://esm.town/v/postpostscript/moduleHighlightValueLink";
23
24export default async function(req: Request): Promise<Response> {
25 return htmlResponse`
26 <iframe src="${getRedirectUrl(import.meta.url, "default", true)}" width="100%" height="100%">

maroonLynxmain.tsx1 match

@liamdanielduffy•Updated 1 year ago
2 [key: string]: string;
3};
4export async function parseCalendarEventsTable(html: string): Promise<TableRow[]> {
5 const { DOMParser } = await import(
6 "https://deno.land/x/deno_dom/deno-dom-wasm.ts"

submitPRREADME.md1 match

@nbbaier•Updated 1 year ago
20## Parameters
21
22The function takes two parameters: your gh access token and an object that's identical to the object submitted to the gh API. See [GH's documentation](https://docs.github.com/en/rest/pulls/pulls?apiVersion=2022-11-28#create-a-pull-request) for more info!
23
24

aliasmain.tsx1 match

@stevekrouse•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2
3export function alias<P extends Params>(params: P): Promise<Result<P>> {
4 const username = params.username;
5 let url = `https://api.val.town/v1/alias/${username}`;

ssr_react_minimain.tsx1 match

@stevekrouse•Updated 1 year ago
35
36export const hydrate = (importMetaURL: string) =>
37 async function(req: Request): Promise<Response> {
38 const { author, name } = extractValInfo(importMetaURL);
39 const valURL = `https://www.val.town/v/${author}/${name}`;

getFileEmail4 file matches

@shouser•Updated 2 weeks 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": "*",