Use __moduleExists from require

This commit is contained in:
Kevin Sawicki
2013-01-18 09:08:34 -08:00
parent f29c3a0836
commit a7f03f4aeb

View File

@@ -28,7 +28,7 @@ require = (path, cb) ->
parts = file.split '.'
ext = parts[parts.length-1]
if __modules[file]?
if __moduleExists file
if not __modules.loaded[file.toLowerCase()]?
console.warn "Circular require: #{__filename} required #{file}"
return __modules[file]
@@ -102,7 +102,7 @@ resolve = (name, {verifyExistence}={}) ->
null
__moduleExists = (path) ->
__modules[path] isnt undefined
__modules[path]?
__moduleExpand = (path) ->
return path if __moduleExists path