diff options
author | Antoine du HAMEL <duhamelantoine1995@gmail.com> | 2020-08-28 00:36:50 +0300 |
---|---|---|
committer | Node.js GitHub Bot <github-bot@iojs.org> | 2020-09-16 01:17:47 +0300 |
commit | d24eecd7d73959872058ea5cee5cd83a9825fa13 (patch) | |
tree | 15ef5802052a690083df0befa0a608cb93b6e54c /lib/internal/modules | |
parent | 8e173836538efb95f5ac5e898f177efff681d2aa (diff) |
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>
Diffstat (limited to 'lib/internal/modules')
-rw-r--r-- | lib/internal/modules/cjs/loader.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js index 0df388c463e..34507ebdad3 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js @@ -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); |