Skip to content

Commit

Permalink
module: use isURLInstance instead of instanceof
Browse files Browse the repository at this point in the history
PR-URL: nodejs#34951
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Derek Lewis <DerekNonGeneric@inf.is>
  • Loading branch information
aduh95 authored and guybedford committed Sep 28, 2020
1 parent b29b966 commit be78b83
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 @@ -1087,7 +1087,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 be78b83

Please sign in to comment.