summaryrefslogtreecommitdiff
path: root/couchjs/js/views.js
diff options
context:
space:
mode:
Diffstat (limited to 'couchjs/js/views.js')
-rw-r--r--couchjs/js/views.js12
1 files changed, 6 insertions, 6 deletions
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));
}
}
})();