From 44e1ccec7e8f75c7e7862d96e35d009e4db68d37 Mon Sep 17 00:00:00 2001 From: Michael Ficarra Date: Fri, 2 Mar 2012 22:49:51 -0500 Subject: [PATCH] `eval`'s `options` argument should default to `{}`, even in the browser --- lib/coffee-script/browser.js | 1 + src/browser.coffee | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/coffee-script/browser.js b/lib/coffee-script/browser.js index b73abeec..198a5fbf 100644 --- a/lib/coffee-script/browser.js +++ b/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)); }; diff --git a/src/browser.coffee b/src/browser.coffee index 8f37c19d..5ed0bea8 100644 --- a/src/browser.coffee +++ b/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