mirror of
https://github.com/denoland/deno.git
synced 2025-03-03 09:31:22 -05:00
docs(std/node/url): Added JSDocs for std/node/url (#7805)
This commit is contained in:
parent
6162807a7e
commit
2259e99aef
1 changed files with 5 additions and 0 deletions
|
@ -39,6 +39,10 @@ const tabRegEx = /\t/g;
|
|||
const _url = URL;
|
||||
export { _url as URL };
|
||||
|
||||
/**
|
||||
* Get fully resolved platform-specific file path from the given URL string/ object
|
||||
* @param path The file URL string or URL object to convert to a path
|
||||
*/
|
||||
export function fileURLToPath(path: string | URL): string {
|
||||
if (typeof path === "string") path = new URL(path);
|
||||
else if (!(path instanceof URL)) {
|
||||
|
@ -108,6 +112,7 @@ function getPathFromURLPosix(url: URL): string {
|
|||
return decodeURIComponent(pathname);
|
||||
}
|
||||
|
||||
/** Get fully resolved platform-specific File URL from the given file path */
|
||||
export function pathToFileURL(filepath: string): URL {
|
||||
let resolved = path.resolve(filepath);
|
||||
// path.resolve strips trailing slashes so we must add them back
|
||||
|
|
Loading…
Add table
Reference in a new issue