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=715&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 7186 results for "function"(612ms)

submitPRmain.tsx1 match

@nbbaier•Updated 1 year ago
2type PR = Parameters<typeof Octokit["rest"]["pulls"]["create"]>;
3
4export async function submitPR(ghToken: string, ...pr: PR) {
5 return new Octokit({ auth: ghToken }).rest.pulls.create(pr);
6}

submitPRREADME.md1 match

@nbbaier•Updated 1 year ago
20## Parameters
21
22The function takes two parameters: your gh access token and an object that's identical to the object submitted to the gh API. See [GH's documentation](https://docs.github.com/en/rest/pulls/pulls?apiVersion=2022-11-28#create-a-pull-request) for more info!
23
24

valToGHREADME.md2 matches

@nbbaier•Updated 1 year ago
1# valToGH
2
3A utility function for programmatically updating a GitHub repository with code retrieved from a Val.
4
5**NOTE**: This function currently does not change the contents of a file if it is already present. I will however be adding that functionality.
6
7## Usage

sqliteDumpREADME.md4 matches

@nbbaier•Updated 1 year ago
1# SQLite Dump Util
2
3A utility function that generates SQL statements to dump the data and schema of tables in a SQLite database.
4
5## Usage
25```
26
27## Function Signature
28
29```typescript
30function sqliteDump(tables?: string[], callback?: ((result: string) => string | void | Promise<void>) | undefined): Promise<string | void>
31```
32
34
35- `tables`: (Optional) Array of table names to include in the dump. If not provided, all tables will be included.
36- `callback`: (Optional) An (potentially async) callback function to process the dump result. The callback receives the dump string as its argument.
37

dbToAPImain.tsx1 match

@nbbaier•Updated 1 year ago
6
7// TODO: implement options
8export async function createServer(db, options: Options & { auth?: { username: string; password: string } } = {}) {
9 const app = new Hono();
10

updateValByIDmain.tsx1 match

@nbbaier•Updated 1 year ago
11}
12
13export function updateValByID({ token, valId, code, name, readme, privacy }: UpdateValArgs): Promise<any> {
14 const body: Record<string, unknown> = {
15 token,

updateValByNamemain.tsx1 match

@nbbaier•Updated 1 year ago
7}
8
9export function updateValByName({ token, code, name }: UpdateValArgs): Promise<any> {
10 const body: Record<string, unknown> = {
11 token,

fetchPaginatedDataREADME.md1 match

@nbbaier•Updated 1 year ago
1# Fetch Paginated Data
2
3This val exports a function that loops through paginated API responses and returns the combined data as an array. It expects pagination with `next` and there to be a `data` property in the API response. This conforms to the Val Town API, so this function is useful when fetching paginated Val Town API responses for creating custom folders in [pomdtr's vscode extension](https://github.com/pomdtr/valtown-vscode).
4
5Usage:

paginatedResponseREADME.md2 matches

@nbbaier•Updated 1 year ago
1# Return a paginated response
2
3A helper function to take an array and return a paginated response. This is useful when defining one's own folders for [pomdtr's vscode extension](https://github.com/pomdtr/valtown-vscode).
4
5Usage:
8const data = [...]
9
10export default async function(req: Request): Promise<Response> {
11 return paginatedResponse(req, data);
12}

dbToAPIREADME.md1 match

@nbbaier•Updated 1 year ago
1## Create an API from a [lowdb blob](https://www.val.town/v/pomdtr/lowdb)
2
3This val exports a function that takes a lowdb instance and returns a [Hono](https://hono.dev) router that can be used to interact with the data. This is the beginning of an implementation of something like [json-server](https://github.com/typicode/json-server) for Val Town.
4
5The resulting server also comes with a frontend at `/`. The code for the frontend can be found [here](https://www.val.town/v/nbbaier/dbToAPIFrontend).

getFileEmail4 file matches

@shouser•Updated 4 days ago
A helper function to build a file's email

TwilioHelperFunctions

@vawogbemi•Updated 2 months ago