Permalink
Browse files

Handle start and end options in JS executed resource queries

  • Loading branch information...
1 parent 0434e9b commit ef8cafdeb159012115054a64fbc5a31f7e4c69c3 @kriszyp kriszyp committed Feb 5, 2010
Showing with 5 additions and 2 deletions.
  1. +5 −2 lib/resource-query.js
View
@@ -178,8 +178,11 @@ exports.executeQuery = function(query, options, target){
js += "});";
first = false;
}
- return eval(js + "target;");
-
+ var results = eval(js + "target;");
+ if(options.start || options.end){
+ return results.slice(options.start || 0, (options.end || Infinity));
+ }
+ return results;
}
function throwMaxIterations(){
throw new Error("Query has taken too much computation, and the user is not allowed to execute resource-intense queries. Increase maxIterations in your config file to allow longer running non-indexed queries to be processed.");

0 comments on commit ef8cafd

Please sign in to comment.