mirror of
https://github.com/denoland/deno.git
synced 2025-01-22 06:09:25 -05:00
feat(std/node): add URL export (#7132)
This commit is contained in:
parent
73288beb15
commit
b7ad544dd6
2 changed files with 12 additions and 0 deletions
|
@ -36,6 +36,9 @@ const newlineRegEx = /\n/g;
|
||||||
const carriageReturnRegEx = /\r/g;
|
const carriageReturnRegEx = /\r/g;
|
||||||
const tabRegEx = /\t/g;
|
const tabRegEx = /\t/g;
|
||||||
|
|
||||||
|
const _url = URL;
|
||||||
|
export { _url as URL };
|
||||||
|
|
||||||
export function fileURLToPath(path: string | URL): string {
|
export function fileURLToPath(path: string | URL): string {
|
||||||
if (typeof path === "string") path = new URL(path);
|
if (typeof path === "string") path = new URL(path);
|
||||||
else if (!(path instanceof URL)) {
|
else if (!(path instanceof URL)) {
|
||||||
|
|
9
std/node/url_test.ts
Normal file
9
std/node/url_test.ts
Normal 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);
|
||||||
|
},
|
||||||
|
});
|
Loading…
Add table
Reference in a new issue