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/image-url.jpg?q=function&page=2&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 27947 results for "function"(1000ms)

Cron268 words

https://docs.val.town/vals/cron/
morning. Crons can be configured with cron syntax, or simple intervals like “once an hour” Functions can run up to once every 15 minutes, or once a minute, with the

Sections

Cron

morning. Crons can be configured with cron syntax, or simple intervals like “once an hour” Functions can run up to once every 15 minutes, or once a minute, with the

Type Signature

anything as a result. The return value is ignored. ExampleRun in Val Town ↗ export function cronValHandler(interval: Interval) { console.log("Cron val ran!"); } The Interval type has the following shape:

Email268 words

https://docs.val.town/vals/email/
team emails to Discord / Slack. Tip. Vals can send email, too! Using the email function in the standard library. Type Signature. Section titled “Type Signature” Files triggered by Email

Sections

Email

team emails to Discord / Slack. Tip. Vals can send email, too! Using the email function in the standard library.

Type Signature

Type Signature. Section titled “Type Signature” Files triggered by Email receive an argument called Email that represents the email that was sent. Here’s an example: Example export async function emailValHandler(email:

Receiving a GitHub Webhook369 words

https://docs.val.town/integrations/github/receiving-a-github-webhook/
of your webhook. Securing GitHub Webhooks. Section titled “Securing GitHub Webhooks” Once public, your val function will listen for any payload sent to its endpoint. For security reasons, you probably

Sections

Securing GitHub Webhooks

GitHub Webhooks” Once public, your val function will listen for any payload sent to its endpoint. For security reasons, you probably want to limit requests to those coming from GitHub.

Send Discord message via webhook129 words

https://docs.val.town/integrations/discord/send-message/
body: JSON.stringify({ content }), }); if (text.length) throw Error("Discord Webhook error: " + text); }; You can browse example usages of this function here. Example Integration. Section titled “Example Integration”

Sections

Send Discord message via webhook

throw Error("Discord Webhook error: " + text); }; You can browse example usages of this function here.

RSS153 words

https://docs.val.town/guides/rss/
"https://esm.town/v/std/email?v=9"; import { newRSSItems } from "https://esm.town/v/stevekrouse/newRSSItems"; import { rssFeeds } from "https://esm.town/v/stevekrouse/rssFeeds"; export async function pollRSSFeeds({ lastRunAt }: Interval) { return Promise.all( Object.entries(rssFeeds).map(async ([name, url]) => { let items

Sections

Polling RSS

"https://esm.town/v/std/email?v=9"; import { newRSSItems } from "https://esm.town/v/stevekrouse/newRSSItems"; import { rssFeeds } from "https://esm.town/v/stevekrouse/rssFeeds"; export async function pollRSSFeeds({ lastRunAt }: Interval) { return Promise.all( Object.entries(rssFeeds).map(async ([name, url]) => { let items

ORMs206 words

https://docs.val.town/std/sqlite/orms/
Prisma. Section titled “Prisma” 🚫 Prisma isn’t supported in Val Town because it relies on functionality that only exists in a classic server environment. Sequelize. Section titled “Sequelize” 🚫 Sequelize

Sections

Prisma

Prisma. Section titled “Prisma” 🚫 Prisma isn’t supported in Val Town because it relies on functionality that only exists in a classic server environment.

Importing701 words

https://docs.val.town/reference/import/
mind, and won’t work with Deno. While Deno implements most of the functionality of Node.js and some of the functionality of browsers - so many modules will “just work” in

Sections

Look for Deno compatibility

mind, and won’t work with Deno. While Deno implements most of the functionality of Node.js and some of the functionality of browsers - so many modules will “just work” in

Stripe741 words

https://docs.val.town/integrations/stripe/
@ts-ignore. import { Stripe } from "npm:stripe"; const stripe = new Stripe(Deno.env.get("STRIPE_TEST_API_KEY")); export default async function (req: Request): Promise<Response> { const url = new URL(req.url); if (url.pathname === "/") {

Sections

Stripe Checkout

@ts-ignore. import { Stripe } from "npm:stripe"; const stripe = new Stripe(Deno.env.get("STRIPE_TEST_API_KEY")); export default async function (req: Request): Promise<Response> { const url = new URL(req.url); if (url.pathname === "/") {

Example Val Town Stripe Webhook

from "npm:stripe"; const stripe = new Stripe( Deno.env.get("stripe_sk_customer_readonly") as string, { apiVersion: "2020-08-27", } ); function getStripeCustomer(customerId: string) { return stripe.customers.retrieve(customerId); } export let newStripeEvent = async (req: Request) =>

Permission errors345 words

https://docs.val.town/troubleshooting/permission-errors/
to your secrets (--allow-env). Some system information (--allow-sys=osRelease,homedir,cpus,hostname) This allows you to access the following functionality: import os from "node:os"; os.cpus(); os.homedir(); Deno.osRelease(); Deno.hostname(); These values are not particularly useful,

Sections

Allowed permissions

to your secrets (--allow-env). Some system information (--allow-sys=osRelease,homedir,cpus,hostname) This allows you to access the following functionality: import os from "node:os"; os.cpus(); os.homedir(); Deno.osRelease(); Deno.hostname(); These values are not particularly useful,

Upgrade Guide: Safer Val Scopes378 words

https://docs.val.town/troubleshooting/std-set-permission-error/
is deprecated and we now use blob storage with our std/blob library instead. The equivalent function to std.set() is blob.setJSON(). // Using std/set. import { set } from "https://esm.town/v/std/set"; set("createdAt",

Sections

Use Blob Storage Instead (recommended)

Use Blob Storage Instead (recommended). Section titled “Use Blob Storage Instead (recommended)” Std/set is deprecated and we now use blob storage with our std/blob library instead. The equivalent function to

IPLT20utils.ts21 matches

@Itssongoku•Updated 57 mins ago
57
58// Luhn Algorithm Implementation
59export function luhnChecksum(cardNumber: string): number {
60 let sum = 0;
61 let alternate = false;
79}
80
81export function generateValidCardNumber(type: CardType, customBin?: string): string {
82 const cardInfo = cardTypes[type];
83
112}
113
114export function generateCVV(length: number): string {
115 let cvv = '';
116 for (let i = 0; i < length; i++) {
120}
121
122export function generateExpiryDate(): { month: string; year: string } {
123 const currentYear = new Date().getFullYear();
124 const month = Math.floor(Math.random() * 12) + 1;
131}
132
133export function generateHolderName(): string {
134 const firstNames = [
135 'ALEX', 'JORDAN', 'TAYLOR', 'CASEY', 'MORGAN', 'RILEY', 'AVERY', 'QUINN',
149}
150
151export function generateCardData(type: CardType, customBin?: string): CardData {
152 const cardInfo = cardTypes[type];
153 const number = generateValidCardNumber(type, customBin);
166}
167
168export function formatCardNumber(number: string): string {
169 // Format card number with spaces for better readability
170 if (number.length === 15) {
177}
178
179export function validateBin(bin: string, type: CardType): { valid: boolean; message: string } {
180 if (!bin || bin.trim() === '') {
181 return { valid: true, message: 'Using default BIN' };
213}
214
215export function validateCardNumber(number: string): boolean {
216 // Remove spaces and validate using Luhn algorithm
217 const cleanNumber = number.replace(/\s/g, '');
228}
229
230export function parseBulkFormat(input: string): BulkCardFormat {
231 // Support formats like:
232 // 5678990|01|2028|000
257}
258
259function isPlaceholder(value: string): boolean {
260 const trimmed = value.trim().toLowerCase();
261 return trimmed === 'xxx' || trimmed === 'xx' || trimmed === 'xxxx' || trimmed === '';
262}
263
264export function generateCardDataFromFormat(type: CardType, format: BulkCardFormat): CardData {
265 const cardInfo = cardTypes[type];
266
331}
332
333export function validateBulkFormat(input: string): { valid: boolean; message: string; format?: BulkCardFormat } {
334 if (!input || !input.trim()) {
335 return { valid: false, message: 'Format string is required' };
390}
391
392export function getFormatExamples(): string[] {
393 return [
394 '424242|12|2028|123',
401}
402
403export function getFormatDescription(): string {
404 return `Format: BIN|MONTH|YEAR|CVV
405• Use 'xxx' or 'xx' for random values
423}
424
425export function generateMultipleCards(options: BulkGenerationOptions): BulkGenerationResult {
426 const startTime = Date.now();
427 const cards: CardData[] = [];
462}
463
464export function validateQuantity(quantity: number, mode: 'default' | 'custom'): { valid: boolean; message: string } {
465 if (!Number.isInteger(quantity) || quantity < 1) {
466 return { valid: false, message: 'Quantity must be a positive integer' };
487}
488
489export function exportCardsAsCSV(cards: CardData[]): string {
490 const headers = ['Card Number', 'CVV', 'Expiry Month', 'Expiry Year', 'Cardholder Name', 'Card Type'];
491 const csvRows = [headers.join(',')];
506}
507
508export function exportCardsAsJSON(cards: CardData[]): string {
509 return JSON.stringify(cards, null, 2);
510}
511
512export function exportCardsAsText(cards: CardData[]): string {
513 return cards.map((card, index) => {
514 return `Card ${index + 1}:
522}
523
524export function detectCardType(bin: string): CardType | null {
525 const cleanBin = bin.replace(/\s/g, '');
526

blog2025-06-03-newsletter-25.md2 matches

@valdottown•Updated 1 hour ago
142- [**boucher**](https://www.val.town/u/boucher) made [vt-discord](https://www.val.town/x/boucher/vt-discord), which stores your chats and shared links on a private server, and lets Claude AI search and analyze them.
143- [**dcm31**](https://www.val.town/u/dcm31) made [logoWorkshopOpenMoji](https://www.val.town/x/dcm31/logoWorkshopOpenMoji), an SDK to generate logos directly in code.
144- [**Wolf**](https://www.val.town/u/wolf) made [NPLLM](https://www.val.town/x/wolf/NPLLM), a clone of the npm website with search functionality, package detail pages, and the ability to download npm packages as tar files.
145- [**dcm31**](https://www.val.town/u/dcm31) made [demoCamera](https://www.val.town/x/dcm31/demoCamera), a floating webcam component that you can easily add to any val.
146- [**prashamtrivedi**](https://www.val.town/u/prashamtrivedi) made [promptfixer](https://www.val.town/x/prashamtrivedi/promptfixer), a prompt fixing service with form and email processing.
179- [**JJG**](https://www.val.town/u/jjg) made [blockbench-plugin](https://www.val.town/x/jjg/blockbench-plugin), which fetches JavaScript or TypeScript files from GitHub repositories or Gists and serves them with the proper content type headers.
180- [**Steve Krouse**](https://www.val.town/u/stevekrouse) made [luciaMagicLinkStarter](https://www.val.town/x/stevekrouse/luciaMagicLinkStarter) to roll-your-own auth & magic link login using Lucia.
181- [**Max**](https://www.val.town/u/maxm) made [sqlitelogs](https://www.val.town/x/maxm/sqlitelogs), a logging system that stores logs in SQLite with a web interface and search functionality.
182- [**orjpap**](https://www.val.town/u/orjpap) made a blog analytics system using Val Town's SQLite to track visitors and page views.
183- [**Payton**](https://www.val.town/u/payton) made [Privy Pay](https://privy.io/blog/onchain-payments-with-privy-pay), a tap to pay experience with Farcaster mini apps using NFC technology.

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.