x = {} if x -> x and= {}, per Michael's suggestion

https://github.com/jashkenas/coffee-script/pull/1324/files#r25463
This commit is contained in:
Trevor Burnham
2011-05-03 16:10:30 -04:00
parent fa2ed81485
commit b9d3bc5b44
2 changed files with 2 additions and 4 deletions

View File

@@ -48,9 +48,7 @@
var Module, mainModule;
mainModule = require.main;
mainModule.filename = process.argv[1] = options.filename ? fs.realpathSync(options.filename) : '.';
if (mainModule.moduleCache) {
mainModule.moduleCache = {};
}
mainModule.moduleCache && (mainModule.moduleCache = {});
if (process.binding('natives').module) {
Module = require('module').Module;
mainModule.paths = Module._nodeModulePaths(path.dirname(options.filename));

View File

@@ -61,7 +61,7 @@ exports.run = (code, options) ->
if options.filename then fs.realpathSync(options.filename) else '.'
# Clear the module cache.
mainModule.moduleCache = {} if mainModule.moduleCache
mainModule.moduleCache and= {}
# Assign paths for node_modules loading
if process.binding('natives').module