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=1726&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 17342 results for "function"(2088ms)

getDayNameREADME.md2 matches

@stevekrouse•Updated 1 year ago
1# Get the day of week name
2
3JavaScript's [`Date.prototype.getDay()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getDay) returns a number that represents the day of the week, `0` for Sunday, `1` for Monday, etc. This function returns the name of the week, ie `"Sunday"`, `"Monday"`, etc.
4
5The function optionally inputs a `Date` object, but will default to the current time if none is provided.
6
7Migrated from folder: Archive/getDayName

mainReferenceREADME.md1 match

@karfau•Updated 1 year ago
2(Ignores any untitled vals, since those are sometimes created as an execution context.)
3
4By passing a function as the first argument you receive all references as arguments, and can pick or transform them, e.g.
5- [@karfau.refToValUrl](https://val.town/v/karfau.refToValUrl)
6

deleteValExampleREADME.md1 match

@neverstew•Updated 1 year ago
2Deletes a specific val.
3
4Pass your API token as a secret to the function. Read more about [authentication](https://docs.val.town/api/authentication) to understand how to generate a token and save it as a secret.
5
6Migrated from folder: docs/api/deleteValExample

testRunnerREADME.md3 matches

@karfau•Updated 1 year ago
5It is extracted into a val to avoid having all that clutter in the same val as your tests.
6
7Each test is a named function (which can be async), the name is used as the name for the test.
8- the input passed as the first argument is passed to each test, great for importing assertion methods, stubs, fixed values, ... everything that you do not mutate during a test
9- if a function is async (it returns a promise) there is a timeout of 2 seconds before the test is marked as failed.
10- all tests are called in the declared order, but async tests run in parallel afterwards, so don't assume any order
11- if a test starts with `skip` it is not executed
13- if all tests pass it returns the output, so it appears in the grey box and the evaluation/run is marked green.
14
15Note: If you are using the test runner to store the result in that val, as described above, it is considered a "JSON val" and has a run button, but it also means that another of your vals could update the val with just any other (JSON) state. Alternatively you can define a function val that calls the test runner and have a separete val to keep the curretn test results, but it means after updating the tests you need to fest save that val and then reevaluate to val storing the test state.
16
17Migrated from folder: testing/testRunner

thisValUrlREADME.md1 match

@neverstew•Updated 1 year ago
1# This Val URL
2
3Returns the URL of the val that calls this function.
4
5See https://www.val.town/v/neverstew.thisValUrlExample

computeScheduleREADME.md1 match

@xkonti•Updated 1 year ago
1# `computeSchedule` function
2Combines several schedule segments together to form a complete schedule for a 24-hour period.
3

computeScheduleSegmentREADME.md1 match

@xkonti•Updated 1 year ago
1# `computeScheduleSegment` function
2Calculates the on/off time spans for a given schedule segment based on the duty cycle.
3

timeSpanUnionREADME.md1 match

@xkonti•Updated 1 year ago
1# `timeSpanUnion` function
2Combines overlapping time spans into single time spans.
3

isInTimeSpanREADME.md1 match

@xkonti•Updated 1 year ago
1# 'isInTimeSpan` function
2Checks if provided time is within the timeframe of the provided time span.
3

forwarderREADME.md1 match

@maas•Updated 1 year ago
8
90. [Log in to Val Town](val.town/auth/signin)
101. [Fork this Val](https://www.val.town/new?code=function+forwardEmail%28e%3A+%7B%0A++from%3A+string%3B%0A++to%3A+string%5B%5D%3B%0A++subject%3A+string%3B%0A++text%3A+string%3B%0A++html%3A+string%3B%0A%7D%29+%7B%0A++console.email%28%7B+html%3A+e.html%2C+subject%3A+e.subject+%7D%29%3B%0A%7D%0A%2F%2F+Forked+from+%40maas.forwardEmail)
111. Publish the Val via **🔒 > Unlisted**
121. Copy the email endpoint via **â‹® > Endpoints > Copy email address**

getFileEmail4 file matches

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

tuna8 file matches

@jxnblk•Updated 1 week ago
Simple functional CSS library for Val Town
webup
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.
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": "*",