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/$%7BsvgDataUrl%7D?q=function&page=29&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 30804 results for "function"(2548ms)

api_ianmenethil_cominfoService.ts4 matches

@ianmenethil•Updated 1 day ago
85
86/**
87 * API info handler function for use in service router
88 * @param c - Hono context with Variables
89 * @returns Response with API information
90 */
91export function getApiInfo(c: Context<{ Variables: Variables }>): Response {
92 try {
93 const info = infoService.getApiInfo();
102
103/**
104 * Version handler function for use in service router
105 * @param c - Hono context with Variables
106 * @returns Response with version information
107 */
108export function getVersion(c: Context<{ Variables: Variables }>): Response {
109 try {
110 const versionInfo = infoService.getVersionInfo();

api_ianmenethil_comhashService.ts12 matches

@ianmenethil•Updated 1 day ago
133 * when calling Zenith's /initiate-payment endpoint.
134 */
135export async function hashData(c: Context<{ Variables: Variables }>): Promise<Response> {
136 const requestId = crypto.randomUUID();
137
251 * Handle v1/v2 versions - Base64 encoding
252 */
253async function handleV1V2(
254 c: Context<{ Variables: Variables }>,
255 requestBody: any,
362 * Handle v3/v4/v5 versions - Hash generation for Zenith fingerprint
363 */
364async function handleV3V4V5(
365 c: Context<{ Variables: Variables }>,
366 requestBody: any,
527}
528
529// ==================== UTILITY FUNCTIONS ====================
530
531/**
532 * Generate hash using Web Crypto API
533 */
534async function generateHash(data: string, algorithm: string): Promise<string> {
535 const encoder = new TextEncoder();
536 const dataBuffer = encoder.encode(data);
575 * Check if timestamp is in valid ISO 8601 format
576 */
577function isValidISO8601(timestamp: string): boolean {
578 try {
579 const date = new Date(timestamp);
594 * Check if timestamp is within acceptable time window (5 minutes)
595 */
596function isTimestampRecent(timestamp: string): boolean {
597 try {
598 const providedTime = new Date(timestamp).getTime();
610 * Format Zod errors for user-friendly error response
611 */
612function formatZodErrors(error: z.ZodError): HashErrorResponse["details"] {
613 return error.errors.map((err) => {
614 const field = err.path.join(".");
643 * Create standardized error response
644 */
645function createHashErrorResponse(
646 code: string,
647 message: string,
666 * Optional info endpoint handler for documentation
667 */
668export async function hashInfo(c: Context): Promise<Response> {
669 const currentTime = new Date().toISOString();
670
825
826/**
827 * Hash handler function for use in service router
828 * @param c - Hono context with Variables
829 * @returns Response with hash result
830 */
831export async function getHash(c: Context<{ Variables: Variables }>): Promise<Response> {
832 return await hashData(c);
833}

api_ianmenethil_comhash.service.ts12 matches

@ianmenethil•Updated 1 day ago
133 * when calling Zenith's /initiate-payment endpoint.
134 */
135export async function hashData(c: Context<{ Variables: Variables }>): Promise<Response> {
136 const requestId = crypto.randomUUID();
137
251 * Handle v1/v2 versions - Base64 encoding
252 */
253async function handleV1V2(
254 c: Context<{ Variables: Variables }>,
255 requestBody: any,
362 * Handle v3/v4/v5 versions - Hash generation for Zenith fingerprint
363 */
364async function handleV3V4V5(
365 c: Context<{ Variables: Variables }>,
366 requestBody: any,
527}
528
529// ==================== UTILITY FUNCTIONS ====================
530
531/**
532 * Generate hash using Web Crypto API
533 */
534async function generateHash(data: string, algorithm: string): Promise<string> {
535 const encoder = new TextEncoder();
536 const dataBuffer = encoder.encode(data);
575 * Check if timestamp is in valid ISO 8601 format
576 */
577function isValidISO8601(timestamp: string): boolean {
578 try {
579 const date = new Date(timestamp);
594 * Check if timestamp is within acceptable time window (5 minutes)
595 */
596function isTimestampRecent(timestamp: string): boolean {
597 try {
598 const providedTime = new Date(timestamp).getTime();
610 * Format Zod errors for user-friendly error response
611 */
612function formatZodErrors(error: z.ZodError): HashErrorResponse["details"] {
613 return error.errors.map((err) => {
614 const field = err.path.join(".");
643 * Create standardized error response
644 */
645function createHashErrorResponse(
646 code: string,
647 message: string,
666 * Optional info endpoint handler for documentation
667 */
668export async function hashInfo(c: Context): Promise<Response> {
669 const currentTime = new Date().toISOString();
670
825
826/**
827 * Hash handler function for use in service router
828 * @param c - Hono context with Variables
829 * @returns Response with hash result
830 */
831export async function getHash(c: Context<{ Variables: Variables }>): Promise<Response> {
832 return await hashData(c);
833}
10} from "../external-apis/firecrawlClient.ts";
11
12// Helper function to get error messages
13// In a real project, move this to a shared utility file (e.g., src/utils/error.utils.ts)
14function getLocalErrorMessage(error: unknown): string {
15 if (error instanceof Error) return error.message;
16 if (typeof error === "string") return error;
26 * Handles requests to the Firecrawl scrape API for a single URL.
27 */
28export async function firecrawlScrapeHandler(
29 c: Context<{ Variables: Variables }>,
30): Promise<Response> {
50 const scrapeInput: ScraperInput = validationResult.data;
51
52 // Call the Firecrawl API through the client function
53 const firecrawlResponse = await fetchFromFirecrawlAPI(scrapeInput);
54
89 * Handles requests to the Firecrawl map API for discovering URLs on a website.
90 */
91export async function firecrawlMapHandler(c: Context<{ Variables: Variables }>): Promise<Response> {
92 try {
93 const requestBody = await c.req.json();
108 const mapInput: FirecrawlMapInput = validationResult.data;
109
110 // Call the dedicated map function with validated input
111 const firecrawlResponse = await performFirecrawlMap(mapInput);
112

api_ianmenethil_comechoService.ts3 matches

@ianmenethil•Updated 1 day ago
36
37/**
38 * Echo Service - Handles echo functionality
39 * Returns request data for testing and debugging purposes
40 */
112
113/**
114 * Echo handler function for use in service router
115 * @param c - Hono context with Variables
116 * @returns Response with echo data
117 */
118export async function echo(c: any): Promise<Response> {
119 try {
120 const method = c.req.method;

api_ianmenethil_comcallbackService.ts7 matches

@ianmenethil•Updated 1 day ago
23 * @returns Sanitized string
24 */
25function sanitizeInput(input: string): string {
26 return input.replace(/[<>\"'&]/g, "").trim();
27}
33 * @returns Parsed timestamp filter object
34 */
35function parseTimestampFilters(from?: string, to?: string): { from?: Date; to?: Date } {
36 const result: { from?: Date; to?: Date } = {};
37
58 * @returns Headers as key-value object
59 */
60function extractHeaders(request: Request): Record<string, string> {
61 const headers: Record<string, string> = {};
62 request.headers.forEach((value, key) => {
71 * @returns Response with callback creation result
72 */
73export async function createCallback(c: Context<{ Variables: Variables }>): Promise<Response> {
74 const requestId = crypto.randomUUID();
75
159 * @returns Response with callback records list
160 */
161export async function listCallbacks(c: Context<{ Variables: Variables }>): Promise<Response> {
162 const requestId = crypto.randomUUID();
163
249 * @returns Response with callback record details
250 */
251export async function getCallback(c: Context<{ Variables: Variables }>): Promise<Response> {
252 const requestId = crypto.randomUUID();
253
316 * @returns Response with deletion confirmation
317 */
318export async function deleteCallback(c: Context<{ Variables: Variables }>): Promise<Response> {
319 const requestId = crypto.randomUUID();
320

api_ianmenethil_comauthService.ts4 matches

@ianmenethil•Updated 1 day ago
18 * Generates and returns a new CSRF token for form protection
19 */
20export function getCsrfToken(c: Context<{ Variables: Variables }>): Response {
21 try {
22 // Generate a secure CSRF token
73 * Returns the current authenticated user from the OAuth session
74 */
75export function getCurrentUser(c: Context<{ Variables: Variables }>): Response {
76 try {
77 // Get session data from cookie
197 * Clears OAuth session cookies and ends the user session
198 */
199export function logout(c: Context<{ Variables: Variables }>): Response {
200 try {
201 // Get current session for logging
265 * Converts API keys to JWT tokens for secure service access
266 */
267export async function exchangeToken(c: Context<{ Variables: Variables }>): Promise<Response> {
268 try {
269 // Extract token key from header or query parameter

api_ianmenethil_comtavilyClient.ts5 matches

@ianmenethil•Updated 1 day ago
104
105// API configuration
106function getTavilyApiKey(): string {
107 const key = Deno.env.get("TAVILY_API_KEY") || "";
108 if (!key) {
117 * Perform a search using the Tavily API.
118 */
119export async function performTavilySearch(input: TavilySearchInput): Promise<unknown> {
120 const apiKey = getTavilyApiKey();
121 const options = {
148 * Perform an extract using the Tavily API.
149 */
150export async function performTavilyExtract(input: TavilyExtractInput): Promise<unknown> {
151 const apiKey = getTavilyApiKey();
152
186 * Perform a crawl using the Tavily API (BETA).
187 */
188export async function performTavilyCrawl(input: TavilyCrawlInput): Promise<unknown> {
189 const apiKey = getTavilyApiKey();
190
228 * Perform a site map using the Tavily API (BETA).
229 */
230export async function performTavilyMap(input: TavilyMapInput): Promise<unknown> {
231 const apiKey = getTavilyApiKey();
232

api_ianmenethil_comfirecrawlClient.ts5 matches

@ianmenethil•Updated 1 day ago
107export type FirecrawlMapInput = z.infer<typeof FirecrawlMapInputSchema>;
108
109function getApiKey(): string {
110 const key = Deno.env.get("FIRECRAWL_API_KEY") || "";
111 if (!key) {
115}
116
117function getFirecrawlClient(): FirecrawlApp {
118 const apiKey = getApiKey();
119 return new FirecrawlApp({ apiKey });
124 * Handles single page scraping with all supported options.
125 */
126export async function fetchFromFirecrawlAPI(
127 input: ScraperInput,
128): Promise<unknown> {
173 * Maps all URLs from a website using Firecrawl's dedicated map endpoint.
174 */
175export async function performFirecrawlMap(
176 input: FirecrawlMapInput,
177): Promise<unknown> {
184
185 // Check if FirecrawlApp has a map method
186 if ("mapUrl" in firecrawl && typeof firecrawl.mapUrl === "function") {
187 // Use the SDK's map method if available
188 return await firecrawl.mapUrl(input.url, {

api_ianmenethil_comserviceRegistry.ts8 matches

@ianmenethil•Updated 1 day ago
12import { exchangeToken, getCsrfToken, getCurrentUser, logout } from "../handlers/authService.ts";
13
14// Documentation services - Updated to use handler functions
15import { getOpenAPIJSON, getOpenAPIYAML } from "../handlers/openapiService.ts";
16import { getSwaggerUI } from "../handlers/swaggerService.ts";
49// import { hashData } from '@/handlers/hash.service.ts';
50
51// // --- Helper function to get error messages ---
52// function getErrorMessage(error: unknown): string {
53// if (error instanceof Error) return error.message;
54// if (typeof error === 'string') return error;
67
68// --- Service Router Creation ---
69export function createServiceRouter(): ServiceRouter {
70 const router: ServiceRouter = {
71 // === Core Auth Handlers ===
83 handleSpotifyCallback,
84
85 // === Documentation Handlers - Now using imported functions ===
86 getOpenAPIJSON,
87 getOpenAPIYAML,
226}
227
228// --- Utility functions for the router ---
229export function getServiceHandler(
230 operationId: string,
231 router: ServiceRouter,
234}
235
236export function listOperations(router: ServiceRouter): string[] {
237 return Object.keys(router);
238}
tuna

tuna9 file matches

@jxnblk•Updated 1 week ago
Simple functional CSS library for Val Town

getFileEmail4 file matches

@shouser•Updated 1 month ago
A helper function to build a file's email
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.