utils
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
If you're running code in Val Town, sometimes you want to know information about the val that's running. This module has functions for that.
import { parseProject } from 'https://esm.town/v/std/utils@71-main/index.ts'
const projectVal = parseProject(import.meta.url)
console.log(projectVal)
The parseProject
function supports two URL formats:
- URLs with version and branch:
https://esm.town/v/username/name@version-branch/path
- URLs without version (latest on main):
https://esm.town/v/username/name/path
When using the second format, the function will set version
to "latest" and branch
to "main".