1export async function extractArgs(code: string) {
2 const { default: ts } = await import("npm:typescript");
3 // Create a source file from the code string
7 ts.ScriptTarget.Latest,
8 );
9 // Traverse the abstract syntax tree (AST) to find the function declaration
10 function findFunctionDeclaration(
11 node: ts.Node,
12 ): ts.FunctionDeclaration | undefined {
13 if (ts.isFunctionDeclaration(node)) {
14 return node;
15 }
16 return node.forEachChild(findFunctionDeclaration);
17 }
18 // Find the function declaration
19 const functionDeclaration = findFunctionDeclaration(sourceFile);
20 if (!functionDeclaration) {
21 return null;
22 }
23 // Extract argument names and types
24 return functionDeclaration.parameters.map((param) => ({
25 name: code.slice(param.name.pos, param.name.end).trim(),
26 type: param.type
5 lon = +lon;
6 lat = +lat;
7 function dist(station) {
8 return Math.sqrt(
9 Math.pow(station.lat - lat, 2) + Math.pow(station.lon - lon, 2)
12 const queryString = await toQueryString({
13 ...options,
14 function: "SYMBOL_SEARCH",
15 });
16
1export function myApi(name) {
2 return "hi " + name;
3}
1export function myApi(name) {
2 return "hi " + name;
3}
1export function myApi(name) {
2 return "hi " + name;
3}
3import { getEmails } from "https://esm.town/v/eric/getEmails";
4
5export function subscribe() {
6 const s = getEmails()
7 console.log(s)
1let { definitelynotnull } = await import("https://esm.town/v/eric/definitelynotnull");
2
3export function oneify() {
4 return definitelynotnull = 1
5}
3import { getEmails } from "https://esm.town/v/eric/getEmails";
4
5untitled6372775 = export async function subscribe() {
6 const s = await getEmails()
7 console.log(s)
1export function myApi(name) {
2 return "hi " + name;
3}
A helper function to build a file's email
Simple functional CSS library for Val Town
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": "*",
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.