Skip to content

Instantly share code, notes, and snippets.

@jmakeig
Created November 12, 2014 23:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmakeig/a66bda99be78dbf721ba to your computer and use it in GitHub Desktop.
Save jmakeig/a66bda99be78dbf721ba to your computer and use it in GitHub Desktop.
Generator to get objects from MarkLogic ValueIterator instances
function* asObjects(itr) {
for(var doc of itr) {
yield doc.toObject();
}
}
var a = [];
for(var obj of asObjects(fn.collection())) {
a.push(obj.name = "Generated: " + obj.name);
}
a;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment