From 348d9e997223333e929e71698768350a50b5070b Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Sat, 6 Apr 2019 01:15:01 +0200 Subject: [PATCH] Update internal Node.js function call This updates the call to _resolveLookupPaths. It returns a string by default since Node.js v8 when called with a third truthy argument. The backwards compatible return value should change soon, so detect what return type is used and handle both cases. Refs: nodejs/node#26983 --- lib/requizzle.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/requizzle.js b/lib/requizzle.js index 21b58d5..312bc7b 100644 --- a/lib/requizzle.js +++ b/lib/requizzle.js @@ -40,13 +40,12 @@ var path = require('path'); */ function isNativeModule(targetPath, parentModule) { - var lookupPaths = Module._resolveLookupPaths(targetPath, parentModule); - - if (lookupPaths[0] === targetPath && lookupPaths[1].length === 0) { - return true; - } - - return false; + var lookupPaths = Module._resolveLookupPaths(targetPath, parentModule, true); + /* istanbul ignore next */ + return lookupPaths === null || + lookupPaths.length === 2 && + lookupPaths[1].length === 0 && + lookupPaths[0] === targetPath; } /**