Permalink
Browse files

Allow cursors to be used as iterators.

  • Loading branch information...
1 parent d8a56e6 commit 8cd4f3ba784377756777e1c1d064e5fd6aa2eea7 @tschaub committed Mar 10, 2012
Showing with 11 additions and 0 deletions.
  1. +11 −0 lib/geoscript/cursor.js
View
@@ -221,4 +221,15 @@ var Cursor = UTIL.extend(GeoObject, {
});
+/**
+ * Allow cursors to be used as iterators.
+ */
+Cursor.prototype.__iterator__ = function() {
+ var feature;
+ while (feature = this.next()) {
+ yield feature;
+ }
+ return;
+};
+
exports.Cursor = Cursor;

0 comments on commit 8cd4f3b

Please sign in to comment.