src: Also revert the URL constructor removal
This commit is contained in:
parent
6cbd76218d
commit
aa095cc048
1 changed files with 5 additions and 1 deletions
|
|
@ -1,6 +1,10 @@
|
||||||
/// <reference lib="esnext"/>
|
/// <reference lib="esnext"/>
|
||||||
/// <reference lib="dom"/>
|
/// <reference lib="dom"/>
|
||||||
|
|
||||||
|
// TODO: Use the `URL` global when targeting Node.js 10
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
||||||
|
const URLGlobal = typeof URL === 'undefined' ? require('url').URL : URL;
|
||||||
|
|
||||||
export type Class<T = unknown> = new (...args: any[]) => T;
|
export type Class<T = unknown> = new (...args: any[]) => T;
|
||||||
|
|
||||||
export const enum TypeName {
|
export const enum TypeName {
|
||||||
|
|
@ -192,7 +196,7 @@ is.urlString = (value: unknown): value is string => {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
new URL(value); // eslint-disable-line no-new
|
new URLGlobal(value); // eslint-disable-line no-new
|
||||||
return true;
|
return true;
|
||||||
} catch {
|
} catch {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue