@@ -142,10 +142,12 @@ function resolveSync(
142
142
}
143
143
}
144
144
145
- const IS_PATH_FILE = 1 ;
146
- const IS_PATH_DIRECTORY = 2 ;
147
- const IS_PATH_OTHER = 3 ;
148
- const checkedPaths = new Map < string , number > ( ) ;
145
+ enum IPathType {
146
+ FILE = 1 ,
147
+ DIRECTORY = 2 ,
148
+ OTHER = 3 ,
149
+ }
150
+ const checkedPaths = new Map < string , IPathType > ( ) ;
149
151
function statSyncCached ( path : string ) : number {
150
152
const result = checkedPaths . get ( path ) ;
151
153
if ( result !== undefined ) {
@@ -163,27 +165,27 @@ function statSyncCached(path: string): number {
163
165
164
166
if ( stat ) {
165
167
if ( stat . isFile ( ) || stat . isFIFO ( ) ) {
166
- checkedPaths . set ( path , IS_PATH_FILE ) ;
167
- return IS_PATH_FILE ;
168
+ checkedPaths . set ( path , IPathType . FILE ) ;
169
+ return IPathType . FILE ;
168
170
} else if ( stat . isDirectory ( ) ) {
169
- checkedPaths . set ( path , IS_PATH_DIRECTORY ) ;
170
- return IS_PATH_DIRECTORY ;
171
+ checkedPaths . set ( path , IPathType . DIRECTORY ) ;
172
+ return IPathType . DIRECTORY ;
171
173
}
172
174
}
173
175
174
- checkedPaths . set ( path , IS_PATH_OTHER ) ;
175
- return IS_PATH_OTHER ;
176
+ checkedPaths . set ( path , IPathType . OTHER ) ;
177
+ return IPathType . OTHER ;
176
178
}
177
179
178
180
/*
179
181
* helper functions
180
182
*/
181
183
function isFile ( file : Config . Path ) : boolean {
182
- return statSyncCached ( file ) === IS_PATH_FILE ;
184
+ return statSyncCached ( file ) === IPathType . FILE ;
183
185
}
184
186
185
187
function isDirectory ( dir : Config . Path ) : boolean {
186
- return statSyncCached ( dir ) === IS_PATH_DIRECTORY ;
188
+ return statSyncCached ( dir ) === IPathType . DIRECTORY ;
187
189
}
188
190
189
191
function isCurrentDirectory ( testPath : Config . Path ) : boolean {
0 commit comments