All files / path / _common / from_file_url.ts

100.00% Branches 5/5
100.00% Lines 8/8
1
2
3
4
5
6
7
8
9
10
11
12
 
 
 
x74
x272
x272
x476
x476
 
x476
x658
x272










// Copyright 2018-2025 the Deno authors. MIT license.
// This module is browser compatible.

export function assertArg(url: URL | string) {
  url = url instanceof URL ? url : new URL(url);
  if (url.protocol !== "file:") {
    throw new TypeError(
      `URL must be a file URL: received "${url.protocol}"`,
    );
  }
  return url;
}