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=819&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 8322 results for "function"(516ms)

testMutateSemantics2main.tsx1 match

@stevekrouse•Updated 1 year ago
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
3
4export async function testMutateSemantics2({
5 stateName,
6 mutateExpected,

questionmain.tsx1 match

@tmcw•Updated 1 year ago
1export function question() {
2 return "hello";
3}

measureValTownE2emain.tsx1 match

@tmcw•Updated 1 year ago
28
29 console.log(
30 `average e2e user function time: ${(
31 userFuncTimes.reduce((a, b) => a + b, 0) / count
32 ).toFixed(0)}ms (fastest was ${userFuncTimes

checkIfTwitterAPIIsDownmain.tsx1 match

@stevekrouse•Updated 1 year ago
7// until it's down, and store the state in
8// @stevekrouse.twitterAPIDown ({ down: boolean, reason: string})
9export async function checkIfTwitterAPIIsDown() {
10 try {
11 // query for something we know will return results

myApimain.tsx1 match

@stevekrouse•Updated 1 year ago
1export function myApi(name) {
2 return "hi " + name;
3}

groupBymain.tsx5 matches

@stevekrouse•Updated 1 year ago
3 * (c) 2019 Tom Bremmer (https://tbremer.com/) and Chris Ferdinandi (https://gomakethings.com), MIT License,
4 * @param {Array} arr The array to group items from
5 * @param {String|Function} criteria The criteria to group by
6 * @return {Object} The grouped object
7 */
8export function groupBy<A>(arr: A[], criteria: ((a: A) => string) | string) {
9 return arr.reduce(function (obj, item) {
10 // Check if the criteria is a function to run on the item or a property of it
11 var key = typeof criteria === "function" ? criteria(item) : item[criteria];
12
13 // If the key doesn't exist yet, create it

doublemain.tsx1 match

@stevekrouse•Updated 1 year ago
1export function double(x: number) {
2 return 2 * x;
3}

openAqNowcastAQImain.tsx1 match

@stevekrouse•Updated 1 year ago
3import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
4
5export async function openAqNowcastAQI({ location_id }) {
6 const { results } = await fetchJSON(
7 "https://api.openaq.org/v2/measurements?" +

testThisExpressUrlmain.tsx1 match

@stevekrouse•Updated 1 year ago
1import { thisExpressURL } from "https://esm.town/v/stevekrouse/thisExpressURL";
2
3export function testThisExpressUrl(req, res) {
4 let url = thisExpressURL();
5 res.send(`<a href="${url}">${url}</a>`);

fetchHTMLmain.tsx2 matches

@stevekrouse•Updated 1 year ago
2import { fetchText } from "https://esm.town/v/stevekrouse/fetchText";
3
4// this function doesn't work yet, I'm still iterating on it
5export function fetchHTML(url: string, options?: any) {
6 return fetchText(url, options)
7 .then(parseHTML);

getFileEmail4 file matches

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

TwilioHelperFunctions

@vawogbemi•Updated 2 months ago