From 3c4555f3cf27cbb62be8e6a817060ffc5333cf08 Mon Sep 17 00:00:00 2001 From: wohali Date: Thu, 15 Nov 2012 13:20:10 -0500 Subject: Update couchjs for static build option, eliminate eval() --- couchjs/js/views.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'couchjs/js/views.js') diff --git a/couchjs/js/views.js b/couchjs/js/views.js index 2a15ee56..f7357b79 100644 --- a/couchjs/js/views.js +++ b/couchjs/js/views.js @@ -30,7 +30,7 @@ var Views = (function() { reductions[i] = null; } }; - var reduce_line = Couch.toJSON(reductions); + var reduce_line = JSON.stringify(reductions); var reduce_length = reduce_line.length; // TODO make reduce_limit config into a number if (State.query_config && State.query_config.reduce_limit && @@ -108,19 +108,19 @@ var Views = (function() { Couch.recursivelySeal(doc); var buf = []; - for (var i = 0; i < State.funs.length; i++) { + for each (fun in State.funs) { map_results = []; try { - State.funs[i](doc); - buf.push(Couch.toJSON(map_results)); + fun(doc); + buf.push(map_results); } catch (err) { handleViewError(err, doc); // If the error is not fatal, we treat the doc as if it // did not emit anything, by buffering an empty array. - buf.push("[]"); + buf.push([]); } } - print("[" + buf.join(", ") + "]"); + print(JSON.stringify(buf)); } } })(); -- cgit v1.2.3