Skip to content
Browse files

`eval`'s `options` argument should default to `{}`, even in the browser

  • Loading branch information...
1 parent 7c1f4b3 commit 44e1ccec7e8f75c7e7862d96e35d009e4db68d37 @michaelficarra michaelficarra committed Mar 2, 2012
Showing with 2 additions and 1 deletion.
  1. +1 −0 lib/coffee-script/browser.js
  2. +1 −1 src/browser.coffee
View
1 lib/coffee-script/browser.js
@@ -7,6 +7,7 @@
CoffeeScript.require = require;
CoffeeScript["eval"] = function(code, options) {
+ if (options == null) options = {};
if (options.bare == null) options.bare = true;
return eval(CoffeeScript.compile(code, options));
};
View
2 src/browser.coffee
@@ -4,7 +4,7 @@ CoffeeScript = require './coffee-script'
CoffeeScript.require = require
# Use standard JavaScript `eval` to eval code.
-CoffeeScript.eval = (code, options) ->
+CoffeeScript.eval = (code, options = {}) ->
options.bare ?= on
eval CoffeeScript.compile code, options

0 comments on commit 44e1cce

Please sign in to comment.
Something went wrong with that request. Please try again.