Like Node.js’ `path.resolve`/`url.resolve` for the browser.