Skip to main content
Module

x/enzastdlib/path/mod.ts>isSubURL

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 isSubURL
import { isSubURL } from "https://deno.land/x/enzastdlib@v0.0.4/path/mod.ts";

Returns if the child is a sub-URL of the parent.

Examples

Example 1

import { assertEquals } from 'https://deno.land/std/testing/asserts.ts';
import { isSubURL } 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(
    isSubURL(URL_A, URL_B),
    true
);

Parameters

parent: URL
child: URL

Returns

boolean