Skip to content

Commit

Permalink
fix: use Object.prototype.hasOwnProperty.call
Browse files Browse the repository at this point in the history
  • Loading branch information
scragg0x authored May 30, 2017
1 parent c316ad8 commit 7fca87c
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 7fca87c

Please sign in to comment.