Skip to content

Commit

Permalink
module: use isURLInstance instead of instanceof
Browse files Browse the repository at this point in the history
PR-URL: #34951
Backport-PR-URL: #35385
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Derek Lewis <DerekNonGeneric@inf.is>
  • Loading branch information
aduh95 authored and codebytere committed Oct 1, 2020
1 parent bf7b796 commit 89a58f6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/internal/modules/cjs/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,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');
Expand Down Expand Up @@ -1089,7 +1089,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);
Expand Down

0 comments on commit 89a58f6

Please sign in to comment.