2024-01-01 21:11:32 +00:00
|
|
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
2023-12-21 07:39:51 +00:00
|
|
|
// Copyright the Browserify authors. MIT License.
|
|
|
|
|
2024-04-29 02:57:30 +00:00
|
|
|
import { fromFileUrl } from "@std/path/from-file-url";
|
2023-12-21 07:39:51 +00:00
|
|
|
|
|
|
|
/**
|
2024-06-07 03:54:50 +00:00
|
|
|
* Convert a URL or string to a path.
|
|
|
|
*
|
|
|
|
* @param pathUrl A URL or string to be converted.
|
|
|
|
*
|
|
|
|
* @returns The path as a string.
|
2023-12-21 07:39:51 +00:00
|
|
|
*/
|
|
|
|
export function toPathString(
|
|
|
|
pathUrl: string | URL,
|
|
|
|
): string {
|
|
|
|
return pathUrl instanceof URL ? fromFileUrl(pathUrl) : pathUrl;
|
|
|
|
}
|