mirror of
https://github.com/atom/atom.git
synced 2026-02-13 08:04:56 -05:00
Perform extension test once
This does not need to be computed on each path since file isn't changing between paths visited
This commit is contained in:
@@ -82,9 +82,10 @@ resolve = (name, {verifyExistence}={}) ->
|
||||
file = expanded
|
||||
|
||||
if not moduleAlreadyLoaded
|
||||
hasExtension = /\.(.+)$/.test(file)
|
||||
paths.some (path) ->
|
||||
fileExists = /\.(.+)$/.test(file) and __exists "#{path}/#{file}"
|
||||
jsFileExists = not /\.(.+)$/.test(file) and __exists "#{path}/#{file}.js"
|
||||
fileExists = hasExtension and __exists "#{path}/#{file}"
|
||||
jsFileExists = not hasExtension and __exists "#{path}/#{file}.js"
|
||||
|
||||
if jsFileExists
|
||||
file = "#{path}/#{file}.js"
|
||||
|
||||
Reference in New Issue
Block a user