Skip to content

Commit 429c17e

Browse files
committed
Support Set.toArray
1 parent 40d40f2 commit 429c17e

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/Set.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,15 @@ var SELF = wb.datamodel.Set = util.inherit(
9191

9292
/**
9393
* @inheritdoc
94-
*
95-
* @throws {Error} when being called since a set cannot be converted to an array.
9694
*/
9795
toArray: function() {
98-
throw new Error( 'Set cannot be exported to an array' );
96+
var items = [];
97+
98+
for( var key in this._items ) {
99+
items.push( this._items[key] );
100+
}
101+
102+
return items;
99103
},
100104

101105
/**

0 commit comments

Comments
 (0)