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=1704&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 17935 results for "function"(1158ms)

myApimain.tsx1 match

@dace•Updated 1 year ago
1export function myApi(name) {
2 return "hi " + name;
3}

setEmailsmain.tsx1 match

@eric•Updated 1 year ago
1let { emails } = await import("https://esm.town/v/eric/emails");
2
3export let setEmails = function(emailSet) {
4 emails = [...emailSet.values()]
5 return emails.length

testPostCallmain.tsx1 match

@mehmet•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3export async function testPostCall() {
4 const result = await fetchJSON(
5 "https://api.val.town/express/@stevekrouse.postWebhook1",

exchangeCurrencymain.tsx1 match

@mgruel•Updated 1 year ago
7 * @param {string} base - The base currency, from which the exchange should be calculated
8 */
9export async function exchangeCurrency(
10 desired: string,
11 amount = 1,

myApimain.tsx1 match

@dng•Updated 1 year ago
1export function myApi(name) {
2 return "hi " + name;
3}

myApimain.tsx1 match

@florian•Updated 1 year ago
1export function myApi(name) {
2 return "hi " + name;
3}

myApimain.tsx1 match

@rolling_coaster•Updated 1 year ago
1export function myApi(name) {
2 return "hi " + name;
3}

pingHttpmain.tsx1 match

@robin•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export async function pingHttp(url: string) {
4 try {
5 const res = await fetch(url);

md5main.tsx23 matches

@tr3ntg•Updated 1 year ago
1export function md5(input) {
2 /*
3 * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
16 var chrsz = 8; /* bits per input character. 8 - ASCII; 16 - Unicode */
17 /*
18 * These are the functions you'll usually want to call
19 * They take string arguments and return either hex or base-64 encoded strings
20 */
21 function hex_md5(s) {
22 return binl2hex(core_md5(str2binl(s), s.length * chrsz));
23 }
24 function b64_md5(s) {
25 return binl2b64(core_md5(str2binl(s), s.length * chrsz));
26 }
27 function str_md5(s) {
28 return binl2str(core_md5(str2binl(s), s.length * chrsz));
29 }
30 function hex_hmac_md5(key, data) {
31 return binl2hex(core_hmac_md5(key, data));
32 }
33 function b64_hmac_md5(key, data) {
34 return binl2b64(core_hmac_md5(key, data));
35 }
36 function str_hmac_md5(key, data) {
37 return binl2str(core_hmac_md5(key, data));
38 }
40 * Perform a simple self-test to see if the VM is working
41 */
42 function md5_vm_test() {
43 return hex_md5("abc") == "900150983cd24fb0d6963f7d28e17f72";
44 }
46 * Calculate the MD5 of an array of little-endian words, and a bit length
47 */
48 function core_md5(x, len) {
49 /* append padding */
50 x[len >> 5] |= 0x80 << ((len) % 32);
131 }
132 /*
133 * These functions implement the four basic operations the algorithm uses.
134 */
135 function md5_cmn(q, a, b, x, s, t) {
136 return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s), b);
137 }
138 function md5_ff(a, b, c, d, x, s, t) {
139 return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t);
140 }
141 function md5_gg(a, b, c, d, x, s, t) {
142 return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t);
143 }
144 function md5_hh(a, b, c, d, x, s, t) {
145 return md5_cmn(b ^ c ^ d, a, b, x, s, t);
146 }
147 function md5_ii(a, b, c, d, x, s, t) {
148 return md5_cmn(c ^ (b | (~d)), a, b, x, s, t);
149 }
151 * Calculate the HMAC-MD5, of a key and some data
152 */
153 function core_hmac_md5(key, data) {
154 var bkey = str2binl(key);
155 if (bkey.length > 16)
167 * to work around bugs in some JS interpreters.
168 */
169 function safe_add(x, y) {
170 var lsw = (x & 0xFFFF) + (y & 0xFFFF);
171 var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
175 * Bitwise rotate a 32-bit number to the left.
176 */
177 function bit_rol(num, cnt) {
178 return (num << cnt) | (num >>> (32 - cnt));
179 }
182 * If chrsz is ASCII, characters >255 have their hi-byte silently ignored.
183 */
184 function str2binl(str) {
185 var bin = Array();
186 var mask = (1 << chrsz) - 1;
192 * Convert an array of little-endian words to a string
193 */
194 function binl2str(bin) {
195 var str = "";
196 var mask = (1 << chrsz) - 1;
202 * Convert an array of little-endian words to a hex string.
203 */
204 function binl2hex(binarray) {
205 var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef";
206 var str = "";
214 * Convert an array of little-endian words to a base-64 string
215 */
216 function binl2b64(binarray) {
217 var tab =
218 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";

addCommentmain.tsx1 match

@vez•Updated 1 year ago
3import { commentsDB } from "https://esm.town/v/vez/commentsDB";
4
5export async function addComment(str) {
6 commentsDB.push(str);
7 await set("commentsDB", commentsDB);

getFileEmail4 file matches

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

tuna8 file matches

@jxnblk•Updated 1 week 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": "*",