Public
Script
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
export const refs = (): ValRef[] => {
return new Error().stack
.split("\n")
.map((line): ValRef | undefined => {
const groups = new URLPattern({
pathname: "/:vis(v|p)/:userHandle/:valName",
}).exec(line.match(/https?:\/\/[^\s\)]+/)?.at(0) ?? "")?.pathname?.groups;
if (groups === undefined) {
return undefined;
}
const { userHandle, valName, vis } = groups;
return {
userHandle,
valName,
visibility: vis === "p" ? "private" : "public",
};
})
.filter(Boolean)
.slice(1);
};
type ValRef = {
userHandle: string;
valName: string;
callNumber?: number;
visibility?: "private" | "public";
};
September 16, 2024