]> git.r.bdr.sh - rbdr/serpentity/blobdiff - lib/serpentity/node_collection.js
Yields nodeCollection instead of nodes array
[rbdr/serpentity] / lib / serpentity / node_collection.js
index 73998b123500f36a6a3b828b672d10720235bfe8..7c2c627e13424acf4ca880f6cf90f1be0e964ce5 100644 (file)
@@ -93,4 +93,13 @@ const NodeCollection = class NodeCollection extends Events {
   }
 };
 
+
+/*
+ * Make the node collection iterable without returning the array directly
+ */
+NodeCollection.prototype[Symbol.iterator] = function * () {
+
+  yield* this.nodes;
+};
+
 module.exports = NodeCollection;