Skip to content

Commit 10faca6

Browse files
authored
Merge pull request #46 from scragg0x/patch-1
fix: use of hasOwnProperty in node version 8
2 parents 1b407ec + 7fca87c commit 10faca6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,9 @@ module.exports = function requireDir(dir, opts) {
9393

9494
// otherwise, go through and try each require.extension key!
9595
for (ext in require.extensions) {
96+
// Node v8+ uses "clean" objects w/o hasOwnProperty for require
9697
// again protect against enumerable object prototype extensions:
97-
if (!require.extensions.hasOwnProperty(ext)) {
98+
if (!Object.prototype.hasOwnProperty.call(require.extensions, ext)) {
9899
continue;
99100
}
100101

0 commit comments

Comments
 (0)