Skip to content

Commit

Permalink
fix: use of hasOwnProperty in node version 8
Browse files Browse the repository at this point in the history
Converted to clean objects here: mscdex/io.js@3d8528d
resolves #45
  • Loading branch information
scragg0x authored May 30, 2017
1 parent 96940cf commit c316ad8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,13 @@ 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) {
// again protect against enumerable object prototype extensions:
if (!require.extensions.hasOwnProperty(ext)) {
if (!hasExt(ext)) {
continue;
}

Expand Down

0 comments on commit c316ad8

Please sign in to comment.