From 10ca05e22e01aed8554bd8ac859951eee18e9bd4 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Mon, 25 Jan 2021 03:14:20 -0500 Subject: [PATCH] Return array instead of iterator for Collection.getChildCollections(true) --- chrome/content/zotero/xpcom/data/collection.js | 2 +- test/tests/translateTest.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/chrome/content/zotero/xpcom/data/collection.js b/chrome/content/zotero/xpcom/data/collection.js index d5f583db7b..83579a93b1 100644 --- a/chrome/content/zotero/xpcom/data/collection.js +++ b/chrome/content/zotero/xpcom/data/collection.js @@ -203,7 +203,7 @@ Zotero.Collection.prototype.getChildCollections = function (asIDs) { // Return collectionIDs if (asIDs) { - return this._childCollections.values(); + return [...this._childCollections.values()]; } // Return Zotero.Collection objects diff --git a/test/tests/translateTest.js b/test/tests/translateTest.js index d7bf416033..6dfc9b2790 100644 --- a/test/tests/translateTest.js +++ b/test/tests/translateTest.js @@ -1196,7 +1196,7 @@ describe("Zotero.Translate", function() { assert.isNumber(translation.newCollections[0].id); assert.lengthOf(translation.newItems, 1); assert.isNumber(translation.newItems[0].id); - var childCollections = Array.from(collection.getChildCollections(true)); + var childCollections = collection.getChildCollections(true); assert.sameMembers(childCollections, translation.newCollections.map(c => c.id)); }); });