File tree 1 file changed +4
-12
lines changed
1 file changed +4
-12
lines changed Original file line number Diff line number Diff line change @@ -33,14 +33,6 @@ const internalModuleReadFile = process.binding('fs').internalModuleReadFile;
33
33
const internalModuleStat = process . binding ( 'fs' ) . internalModuleStat ;
34
34
const preserveSymlinks = ! ! process . binding ( 'config' ) . preserveSymlinks ;
35
35
36
- // If obj.hasOwnProperty has been overridden, then calling
37
- // obj.hasOwnProperty(prop) will break.
38
- // See: https://github.com/joyent/node/issues/1707
39
- function hasOwnProperty ( obj , prop ) {
40
- return Object . prototype . hasOwnProperty . call ( obj , prop ) ;
41
- }
42
-
43
-
44
36
function stat ( filename ) {
45
37
filename = path . _makeLong ( filename ) ;
46
38
const cache = stat . cache ;
@@ -95,12 +87,12 @@ const debug = Module._debug;
95
87
// -> a/index.<ext>
96
88
97
89
// check if the directory is a package.json dir
98
- const packageMainCache = { } ;
90
+ const packageMainCache = Object . create ( null ) ;
99
91
100
92
function readPackage ( requestPath ) {
101
- if ( hasOwnProperty ( packageMainCache , requestPath ) ) {
102
- return packageMainCache [ requestPath ] ;
103
- }
93
+ const entry = packageMainCache [ requestPath ] ;
94
+ if ( entry )
95
+ return entry ;
104
96
105
97
const jsonPath = path . resolve ( requestPath , 'package.json' ) ;
106
98
const json = internalModuleReadFile ( path . _makeLong ( jsonPath ) ) ;
You can’t perform that action at this time.
0 commit comments