Commit febb6451 authored by 0mkar's avatar 0mkar

use array filter instead forEach

parent e07f3b90
...@@ -96,9 +96,9 @@ export class ImportResolver { ...@@ -96,9 +96,9 @@ export class ImportResolver {
} }
const builtinHandlers: Handler[] = this.getHandlers() const builtinHandlers: Handler[] = this.getHandlers()
const handlers: Handler[] = customHandlers ? [...builtinHandlers, ...customHandlers] : [...builtinHandlers] const handlers: Handler[] = customHandlers ? [...builtinHandlers, ...customHandlers] : [...builtinHandlers]
handlers.forEach(handler => { const matchedHandler = handlers.filter(handler => handler.match(filePath))
const handler: Handler = matchedHandler[0]
const match = handler.match(filePath) const match = handler.match(filePath)
if(match) {
const content: any = handler.handle(match) const content: any = handler.handle(match)
imported = { imported = {
content, content,
...@@ -106,8 +106,6 @@ export class ImportResolver { ...@@ -106,8 +106,6 @@ export class ImportResolver {
type: handler.type type: handler.type
} }
this.previouslyHandled[filePath] = imported this.previouslyHandled[filePath] = imported
}
})
return imported return imported
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment