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=2051&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 22744 results for "function"(2246ms)

getHashForUrlmain.tsx1 match

@vladimyr•Updated 1 year ago
2
3// Retrieves the URL, and returns a hash of its contents.
4export async function getHashForUrl(url: string): Promise<string> {
5 // Fetch the content from the URL
6 const response = await fetch(url);

fetch_docsmain.tsx2 matches

@andreterron•Updated 1 year ago
2
3/**
4 * Wraps the JavaScript Fetch function to anonymize where the request is
5 * coming from ([Docs ↗](https://docs.val.town/std/fetch))
6 *
9 * method, headers, etc) ([Docs ↗](https://deno.land/api@v1.42.1?s=RequestInit))
10 */
11export async function fetch(input: string | URL | Request, requestInit?: RequestInit) {
12 const origReq = new Request(input, requestInit);
13 const url = new URL("/v1/fetch", API_URL);

fetchmain.tsx2 matches

@vladimyr•Updated 1 year ago
2
3/**
4 * Wraps the JavaScript Fetch function to anonymize where the request is
5 * coming from ([Docs ↗](https://docs.val.town/std/fetch))
6 *
9 * method, headers, etc) ([Docs ↗](https://deno.land/api@v1.42.1?s=RequestInit))
10 */
11export async function fetch(input: string | URL | Request, requestInit?: RequestInit) {
12 const origReq = new Request(input, requestInit);
13 const url = new URL("/v1/fetch", API_URL);
3import { email } from "https://esm.town/v/std/email?v=12";
4
5export default async function(interval: Interval) {
6 const dynamiclandWebsiteHash = await blob.getJSON("dynamiclandWebsiteHash");
7 const newHash = await getHashForUrl("https://dynamicland.org/");

getHashForUrlmain.tsx1 match

@janpaul123•Updated 1 year ago
3
4// Retrieves the URL, and returns a hash of its contents.
5export async function getHashForUrl(url: string): Promise<string> {
6 // Fetch the content from the URL
7 const response = await fetch(url);

sqlitemain.tsx5 matches

@std•Updated 1 year ago
31
32// ------------
33// Functions
34// ------------
35
36async function execute(statement: InStatement): Promise<ResultSet> {
37 const res = await fetch(`${API_URL}/v1/sqlite/execute`, {
38 method: "POST",
48}
49
50async function batch(statements: InStatement[], mode?: TransactionMode): Promise<ResultSet[]> {
51 const res = await fetch(`${API_URL}/v1/sqlite/batch`, {
52 method: "POST",
62}
63
64function createResError(body: string) {
65 try {
66 const e = zLibsqlError.parse(JSON.parse(body));
113 *
114 * The types are currently shown for types declared in a SQL table. For
115 * column types of function calls, for example, an empty string is
116 * returned.
117 */

fetchmain.tsx2 matches

@std•Updated 1 year ago
3
4/**
5 * Wraps the JavaScript Fetch function to anonymize where the request is
6 * coming from ([Docs ↗](https://docs.val.town/std/fetch))
7 *
10 * method, headers, etc) ([Docs ↗](https://deno.land/api@v1.42.1?s=RequestInit))
11 */
12export async function fetch(input: string | URL, requestInit?: RequestInit) {
13 let query = new URLSearchParams({
14 url: input.toString(),

email_docsmain.tsx1 match

@andreterron•Updated 1 year ago
12 * The email address(es) to send the email to. Only available to Val Town Pro subscribers.
13 * Can be a single string, IAddress object, or an array of strings/IAddress objects.
14 * @default the email of the logged user calling this function.
15 */
16 to?: (IAddress | string)[] | IAddress | string;

sqlite_docsmain.tsx5 matches

@andreterron•Updated 1 year ago
31
32// ------------
33// Functions
34// ------------
35
36async function execute(statement: InStatement): Promise<ResultSet> {
37 const res = await fetch(`${API_URL}/v1/sqlite/execute`, {
38 method: "POST",
48}
49
50async function batch(statements: InStatement[], mode?: TransactionMode): Promise<ResultSet[]> {
51 const res = await fetch(`${API_URL}/v1/sqlite/batch`, {
52 method: "POST",
62}
63
64function createResError(body: string) {
65 try {
66 const e = zLibsqlError.parse(JSON.parse(body));
113 *
114 * The types are currently shown for types declared in a SQL table. For
115 * column types of function calls, for example, an empty string is
116 * returned.
117 */

blob_docsmain.tsx9 matches

@andreterron•Updated 1 year ago
4
5/**
6 * Provides functions for interacting with your account's blob storage.
7 * Blobs can store any data type (text, JSON, images, etc.) and allow
8 * retrieval across different vals using the same key.
80};
81
82async function list(prefix?: string): Promise<{ key: string; size: number; lastModified: string }[]> {
83 let querystring = prefix ? `?prefix=${encodeURIComponent(prefix)}` : "";
84 const res = await fetch(`${API_URL}/v1/blob${querystring}`, {
94}
95
96async function delete_(key: string) {
97 const res = await fetch(`${API_URL}/v1/blob/${encodeURIComponent(key)}`, {
98 method: "DELETE",
107}
108
109async function get(key: string) {
110 const res = await fetch(`${API_URL}/v1/blob/${encodeURIComponent(key)}`, {
111 headers: {
123}
124
125async function set(key: string, value: BodyInit) {
126 const res = await fetch(`${API_URL}/v1/blob/${encodeURIComponent(key)}`, {
127 method: "POST",
137}
138
139async function copy(previous: string, next: string) {
140 const res = await get(previous);
141 await set(next, res.body);
142}
143
144async function move(previous: string, next: string) {
145 await copy(previous, next);
146 await delete_(previous);
147}
148
149async function getJSON(key: string) {
150 try {
151 const res = await get(key);
159}
160
161async function setJSON(key: string, value: any) {
162 return set(key, JSON.stringify(value));
163}

getFileEmail4 file matches

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

tuna8 file matches

@jxnblk•Updated 1 month 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.