Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/snel/core/router/utils.js>resolve

A Cybernetical framework for svelte applications in deno
Latest
function resolve
import { resolve } from "https://deno.land/x/snel@v0.7.1/core/router/utils.js";

Resolve URIs as though every path is a directory, no files. Relative URIs in the browser can feel awkward because not only can you be "in a directory", you can be "at a file", too. For example:

browserSpecResolve('foo', '/bar/') => /bar/foo browserSpecResolve('foo', '/bar') => /foo

But on the command line of a file system, it's not as complicated. You can't cd from a file, only directories. This way, links have to know less about their current path. To go deeper you can do this:

Just like cd, if you want to go deeper from the command line, you do this:

cd deeper

not

cd $(pwd)/deeper

By treating every path as a directory, linking to relative paths should require less contextual information and (fingers crossed) be more intuitive.