diff options
author | wohali <joant@ieee.org> | 2012-11-15 13:20:10 -0500 |
---|---|---|
committer | wohali <joant@ieee.org> | 2012-11-15 13:20:10 -0500 |
commit | 3c4555f3cf27cbb62be8e6a817060ffc5333cf08 (patch) | |
tree | 37c028b7c16535f808c581c251f7dbbc42a28b8f /couchjs/js/loop.js | |
parent | 7af6efe1e40fa5782ee97e0af99de32578d8a2a3 (diff) |
Update couchjs for static build option, eliminate eval()
Diffstat (limited to 'couchjs/js/loop.js')
-rw-r--r-- | couchjs/js/loop.js | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/couchjs/js/loop.js b/couchjs/js/loop.js index d2a07f61..af4d65df 100644 --- a/couchjs/js/loop.js +++ b/couchjs/js/loop.js @@ -19,7 +19,7 @@ function init_sandbox() { sandbox.emit = Views.emit; sandbox.sum = Views.sum; sandbox.log = log; - sandbox.toJSON = Couch.toJSON; + sandbox.toJSON = JSON.stringify; sandbox.JSON = JSON; sandbox.provides = Mime.provides; sandbox.registerType = Mime.registerType; @@ -27,6 +27,7 @@ function init_sandbox() { sandbox.send = Render.send; sandbox.getRow = Render.getRow; sandbox.isArray = isArray; + sandbox.index = Dreyfus.index; } catch (e) { log(e.toSource()); } @@ -100,11 +101,13 @@ var Loop = function() { "ddoc" : DDoc.ddoc, // "view" : Views.handler, "reset" : State.reset, + "add_att" : State.addAtt, "add_fun" : State.addFun, "add_lib" : State.addLib, "map_doc" : Views.mapDoc, "reduce" : Views.reduce, - "rereduce" : Views.rereduce + "rereduce" : Views.rereduce, + "index_doc": Dreyfus.indexDoc }; function handleError(e) { var type = e[0]; @@ -122,7 +125,7 @@ var Loop = function() { } }; while (line = readline()) { - cmd = eval('('+line+')'); + cmd = JSON.parse(line); State.line_length = line.length; try { cmdkey = cmd.shift(); |