1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-21 21:50:00 -05:00

feat(std/node): add URL export (#7132)

This commit is contained in:
Benjamin Lupton 2020-08-22 12:39:56 +10:00 committed by GitHub
parent 73288beb15
commit b7ad544dd6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 0 deletions

View file

@ -36,6 +36,9 @@ const newlineRegEx = /\n/g;
const carriageReturnRegEx = /\r/g;
const tabRegEx = /\t/g;
const _url = URL;
export { _url as URL };
export function fileURLToPath(path: string | URL): string {
if (typeof path === "string") path = new URL(path);
else if (!(path instanceof URL)) {

9
std/node/url_test.ts Normal file
View file

@ -0,0 +1,9 @@
import { assertEquals } from "../testing/asserts.ts";
import * as url from "./url.ts";
Deno.test({
name: "[url] URL",
fn() {
assertEquals(url.URL, URL);
},
});