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=816&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 8323 results for "function"(392ms)

safeCountermain.tsx1 match

@stevekrouse•Updated 1 year ago
18 //
19 // Note 1: If I referenced @stevekrouse.threadsafeStateEx here
20 // it would return the value of that val at the beginning of this function,
21 // before I acquired the lock. I fetch it's value now to get the most up-to-date
22 // value of it, now that I know it can't be updated until I release this lock.

expressContentTypeTestmain.tsx1 match

@stevekrouse•Updated 1 year ago
1export function expressContentTypeTest(req, res) {
2 res.send(req.body.a.b);
3}

expressHTMLExample2main.tsx1 match

@stevekrouse•Updated 1 year ago
1// View at https://stevekrouse-expressHTMLExample2.express.val.run?name=Steve
2export async function expressHTMLExample2(
3 req: express.Request,
4 res: express.Response,

handleOnboardingReferralmain.tsx1 match

@stevekrouse•Updated 1 year ago
3
4// Triggered when someone tells us how they hear about VT on onboarding
5export async function handleOnboardingReferral({ auth, referral, handle }: {
6 auth: string;
7 referral: string;

untitled_return_me_valmain.tsx1 match

@stevekrouse•Updated 1 year ago
1import { private_library_val } from "https://esm.town/v/stevekrouse/private_library_val";
2
3export function untitled_return_me_val() {
4 return private_library_val;
5}

projmain.tsx1 match

@tmcw•Updated 1 year ago
1export function proj(ll: Pos2): Pos2 {
2 // Arbitrary.
3 const D2R = Math.PI / 180;

untitled_mutate_test_statemain.tsx1 match

@stevekrouse•Updated 1 year ago
1let { untitled_test_state } = await import("https://esm.town/v/stevekrouse/untitled_test_state");
2
3export function untitled_mutate_test_state(newState) {
4 return (untitled_test_state = newState);
5}

openaiOpenAPImain.tsx8 matches

@stevekrouse•Updated 1 year ago
4 title: Val Town API
5 description: |
6 The Val Town API provides services to evaluate JavaScript and TypeScript expressions, run vals as APIs, either as functions or Express handlers.
7
8 Learn more at [https://docs.val.town](https://docs.val.town)
35 description: |
36 The JavaScript or TypeScript expression to be evaluated.
37 This should be a single expression, like a single function
38 call, assignment operation, or calculation. If you need
39 to execute multiple expressions, wrap them in a function.
40 schema:
41 type: string
44 value: "1+1"
45 summary: Simple addition
46 functionCall:
47 value: "@stevekrouse.addOne(@stevekrouse.example1)"
48 summary: Calling a user's val function
49 handle:
50 name: handle
71 summary: "id"
72 description: |
73 This val is a function that returns its arguments. It is useful for testing how the API handles the arguments passed to it.
74
75 View the val at [https://val.town/v/stevekrouse.id](https://val.town/v/stevekrouse.id)
92 value: 2
93 summary: Simple addition result
94 functionCall:
95 value: 42
96 summary: Calling a function result
97
98security:

unescapeHtmlmain.tsx1 match

@stevekrouse•Updated 1 year ago
1export function unescapeHtml(unsafe) {
2 return unsafe
3 .replace(/&/g, "&")

handleFormExample2main.tsx1 match

@stevekrouse•Updated 1 year ago
2import { email } from "https://esm.town/v/std/email?v=9";
3
4export async function handleFormExample2(params) {
5 await email({
6 text: JSON.stringify(params, null, 2),

getFileEmail4 file matches

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

TwilioHelperFunctions

@vawogbemi•Updated 2 months ago