FeaturesTemplatesShowcaseTownie
AI
BlogDocsPricing
Log inSign up
std
stdutils
Val Town Utilities
Public
Like
3
utils
Home
Code
6
file
1
parseImportMeta
3
serve-file
1
test
2
README.md
index.ts
Branches
4
Pull requests
1
Remixes
7
History
Environment variables
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.
Sign up now
Code
/
parseImportMeta
/
README.md
Code
/
parseImportMeta
/
README.md
Search
5/8/2025
Viewing readonly version of parse-without-version branch: v5
View latest version
README.md

Utilities for parsing import.meta.url

parseProject tests

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.

Usage

Create val
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:

  1. URLs with version and branch: https://esm.town/v/username/name@version-branch/path
  2. 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".

Prior art

  • @pomdtr/extractValInfo
  • @easrng/whoami
Go to top
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Product
FeaturesPricing
Developers
DocsStatusAPI ExamplesNPM Package Examples
Explore
ShowcaseTemplatesNewest ValsTrending ValsNewsletter
Company
AboutBlogCareersBrandhi@val.town
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.