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=726&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 7308 results for "function"(551ms)

cisaKEVToRSSmain.tsx4 matches

@hrbrmstr•Updated 7 months ago
3const RSS_FEED_URL = "https://hrbrmstr-cisakevtorss.web.val.run"; // Update this to your actual RSS feed URL
4
5function escapeXML(str: string): string {
6 return str.replace(/&/g, "&")
7 .replace(/</g, "&lt;")
11}
12
13function removeInvalidXMLChars(str: string): string {
14 return str
15 .replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g, "") // Control characters
19}
20
21function generateRSS(data: any): string {
22 const { title, catalogVersion, dateReleased, vulnerabilities } = data;
23
68}
69
70export async function handler(req: Request): Promise<Response> {
71 try {
72 const response = await fetch(CISA_JSON_URL);

emailmain.tsx1 match

@shouser•Updated 8 months 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;

cronLoggermain.tsx2 matches

@nbbaier•Updated 9 months ago
5import { refs } from "https://esm.town/v/stevekrouse/refs?v=11";
6
7type CronFunction = (interval: Interval) => Promise<void>;
8
9export const cronEvalLogger = (cron: CronFunction): CronFunction => {
10 let interval: Interval;
11 const cronProxy = new Proxy(cron, {

mdConvertmain.tsx1 match

@nbbaier•Updated 11 months ago
9});
10
11export default async function handler(request: Request) {
12 if (request.method !== "POST") {
13 return html(`

valToGHmain.tsx5 matches

@nbbaier•Updated 1 year ago
4import { DateTime } from "npm:luxon";
5
6async function getLatestCommit(ghUser: string, ghRepo: string, branch: string, client: Octokit)
7{
8 const { data: refData } = await client.rest.git.getRef({
15}
16
17async function createNewTree(
18 ghUser: string,
19 ghRepo: string,
40}
41
42async function createNewCommit(
43 ghUser: string,
44 ghRepo: string,
60}
61
62async function updateBranchRef(
63 owner: string,
64 repo: string,
92 */
93
94export async function valToGH(
95 repo: string, // owner/repo
96 val: string | string[], // user/val

sqliteDumpmain.tsx2 matches

@nbbaier•Updated 1 year ago
2import { sqlite } from "https://esm.town/v/std/sqlite";
3
4function generateInsertStatements(
5 tableName: string,
6 columns: string[],
20}
21
22export async function sqliteDump(
23 tables?: string[],
24 callback?: (result: string) => string | void | Promise<void>,

readabilityHTTPProxymain.tsx2 matches

@nbbaier•Updated 1 year ago
56};
57
58export default async function(req: Request): Promise<Response> {
59 const JSDOM = jsdom.JSDOM;
60 const url = new URL(req.url);
77
78 <script>
79 document.getElementById('nameForm').onsubmit = function(event) {
80 event.preventDefault();
81 const targetURL = document.getElementById("name").value

httpMockingExamplemain.tsx1 match

@tmcw•Updated 1 year ago
4 * member.
5 */
6export const httpHandler = async function(req: Request): Promise<Response> {
7 if (req.method !== "POST") return new Response("Bad request: only POST allowed", { status: 400 });
8 const body = await req.json();

listSqliteTablesmain.tsx1 match

@nbbaier•Updated 1 year ago
1import { sqlite } from "https://esm.town/v/std/sqlite?v=4";
2
3export async function listSqliteTables() {
4 return (await sqlite.execute(
5 `select name from sqlite_schema where type='table' and name != 'libsql_wasm_func_table' and name != 'sqlite_sequence'`,

filterValsREADME.md1 match

@nbbaier•Updated 1 year ago
1# filterVals
2
3This val exports a utility function that returns a list of all a user's val, filtered by a callback function.
4
5## Example

getFileEmail4 file matches

@shouser•Updated 5 days ago
A helper function to build a file's email

TwilioHelperFunctions

@vawogbemi•Updated 2 months ago