@@ -47,9 +47,9 @@ function findMatchingFolderOnLevel(parentPath, testPath, existingParams) {
4747 } ) ;
4848 }
4949 fs . readdirSync ( parentPath )
50- . filter ( file => fs . lstatSync ( path . join ( parentPath , file ) ) . isDirectory ( ) )
51- . filter ( folder_name => folder_name . slice ( 0 , 2 ) === '__' && folder_name . slice ( - 2 ) === '__' )
52- . map ( wildcardFolder => ( {
50+ . filter ( ( file ) => fs . lstatSync ( path . join ( parentPath , file ) ) . isDirectory ( ) )
51+ . filter ( ( folder_name ) => folder_name . slice ( 0 , 2 ) === '__' && folder_name . slice ( - 2 ) === '__' )
52+ . map ( ( wildcardFolder ) => ( {
5353 param : wildcardFolder . slice ( 2 , - 2 ) ,
5454 folder : wildcardFolder
5555 } ) )
@@ -89,7 +89,7 @@ function findMatchingPath(requestPath, requestMethodFiles) {
8989 const pathOptions = recurseLookup ( [ pathParts . shift ( ) ] , pathParts , [ ] ) ;
9090
9191 let result = false ;
92- pathOptions . some ( pathOption => requestMethodFiles . some ( ( requestMethodFile ) => {
92+ pathOptions . some ( ( pathOption ) => requestMethodFiles . some ( ( requestMethodFile ) => {
9393 if ( fs . existsSync ( path . join ( pathOption . path , requestMethodFile ) ) ) {
9494 result = {
9595 path : path . resolve ( path . join ( pathOption . path , requestMethodFile ) ) ,
@@ -182,7 +182,9 @@ module.exports = function (urlRoot, pathRoot) {
182182 customMiddleware = [ ] . concat ( ...customMiddleware ) ;
183183
184184 customMiddleware . reduce ( ( chain , middleware ) => chain . then (
185- ( ) => new Promise ( resolve => middleware ( request , response , resolve ) )
185+ ( ) => new Promise ( ( resolve ) => {
186+ middleware ( request , response , resolve ) ;
187+ } )
186188 ) , Promise . resolve ( ) ) . then ( next ) ;
187189 } ;
188190
@@ -222,7 +224,7 @@ module.exports = function (urlRoot, pathRoot) {
222224
223225 const methodFiles = [ jsMockFile , staticMockFile , wildcardJsMockFile , wildcardStaticMockFile ] ;
224226
225- const matchedMethodFile = methodFiles . find ( methodFile => fs . existsSync ( path . join ( targetFullPath , methodFile ) ) ) ;
227+ const matchedMethodFile = methodFiles . find ( ( methodFile ) => fs . existsSync ( path . join ( targetFullPath , methodFile ) ) ) ;
226228
227229 if ( matchedMethodFile ) {
228230 return returnForPath ( path . resolve ( path . join ( targetFullPath , matchedMethodFile ) ) ) ;
0 commit comments