Skip to main content
Module

x/enzastdlib/path/mod.ts>relativePathname

enzastdlib is a set of TypeScript modules that follow a common design API philosophy aiming at sane defaults and ease-of-use targeting the Deno TypeScript runtime.
Latest
function relativePathname
Re-export
import { relativePathname } from "https://deno.land/x/enzastdlib@v0.0.4/path/mod.ts";

Returns the pathname of to as relative to from.

Examples

Example 1

import { assertEquals } from 'https://deno.land/std/testing/asserts.ts';
import { relativePathname } from 'https://deno.land/x/enzastdlib/path/mod.ts';

const URL_A = new URL("https://example.domain/assets");
const URL_B = new URL("https://example.domain/assets/scripts/main.js");

assertEquals(
    relativePathname(URL_A, URL_B),
    'scripts/main.js'
);

Returns

string