mirror of
https://github.com/nodejs/node.git
synced 2026-11-29 14:27:57 -05:00
module: use isURLInstance instead of instanceof
PR-URL: https://github.com/nodejs/node/pull/34951 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Derek Lewis <DerekNonGeneric@inf.is>
This commit is contained in:
1 parent
8e17383653
commit
d24eecd7d7
1 file changed
+2
-2
@@ -60,7 +60,7 @@ const {
|
||||
maybeCacheSourceMap,
|
||||
rekeySourceMap
|
||||
} = require('internal/source_map/source_map_cache');
|
||||
const { pathToFileURL, fileURLToPath, URL } = require('internal/url');
|
||||
const { pathToFileURL, fileURLToPath, isURLInstance } = require('internal/url');
|
||||
const { deprecate } = require('internal/util');
|
||||
const vm = require('vm');
|
||||
const assert = require('internal/assert');
|
||||
@@ -1169,7 +1169,7 @@ const createRequireError = 'must be a file URL object, file URL string, or ' +
|
||||
function createRequire(filename) {
|
||||
let filepath;
|
||||
|
||||
if (filename instanceof URL ||
|
||||
if (isURLInstance(filename) ||
|
||||
(typeof filename === 'string' && !path.isAbsolute(filename))) {
|
||||
try {
|
||||
filepath = fileURLToPath(filename);
|
||||
|
||||
Reference in new issue
Block a user