We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 903b703 commit 71a51b5Copy full SHA for 71a51b5
1 file changed
v3/src/structs/Set.js
@@ -51,9 +51,9 @@ Set.prototype = {
51
}
52
},
53
54
+ // For when you know this Set will be modified during the iteration
55
each: function (callback)
56
{
- // Because it's highly likely the callback may modify the Set
57
var temp = this.values.slice();
58
59
for (var i = 0; i < temp.length; i++)
@@ -65,6 +65,18 @@ Set.prototype = {
65
66
67
68
+ // For when you absolutely know this Set won't be modified during the iteration
69
+ iterate: function (callback)
70
+ {
71
+ for (var i = 0; i < this.values.length; i++)
72
73
+ if (callback(this.values[i]) === false)
74
75
+ break;
76
+ }
77
78
+ },
79
+
80
clear: function ()
81
82
this.values.length = 0;
0 commit comments