From 7fca87ce9659e920675460a81f9e61f56e4c8fec Mon Sep 17 00:00:00 2001 From: Matthew Scragg Date: Tue, 30 May 2017 17:05:16 -0500 Subject: [PATCH] fix: use Object.prototype.hasOwnProperty.call --- index.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 7b238dd..ff2599a 100644 --- a/index.js +++ b/index.js @@ -91,13 +91,11 @@ module.exports = function requireDir(dir, opts) { continue; } - // Node v8+ uses "clean" objects w/o hasOwnProperty for require - var hasExt = require.extensions.hasOwnProperty || function(ext) { return require.extensions[ext]; }; - // otherwise, go through and try each require.extension key! for (ext in require.extensions) { + // Node v8+ uses "clean" objects w/o hasOwnProperty for require // again protect against enumerable object prototype extensions: - if (!hasExt(ext)) { + if (!Object.prototype.hasOwnProperty.call(require.extensions, ext)) { continue; }