Skip to content

Commit 7fca87c

Browse files
authored
fix: use Object.prototype.hasOwnProperty.call
1 parent c316ad8 commit 7fca87c

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

index.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,11 @@ module.exports = function requireDir(dir, opts) {
9191
continue;
9292
}
9393

94-
// Node v8+ uses "clean" objects w/o hasOwnProperty for require
95-
var hasExt = require.extensions.hasOwnProperty || function(ext) { return require.extensions[ext]; };
96-
9794
// otherwise, go through and try each require.extension key!
9895
for (ext in require.extensions) {
96+
// Node v8+ uses "clean" objects w/o hasOwnProperty for require
9997
// again protect against enumerable object prototype extensions:
100-
if (!hasExt(ext)) {
98+
if (!Object.prototype.hasOwnProperty.call(require.extensions, ext)) {
10199
continue;
102100
}
103101

0 commit comments

Comments
 (0)