Skip to content

Commit e0adac3

Browse files
committed
Added abillity to count children with matching properties
1 parent ca7acdc commit e0adac3

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

v3/src/structs/List.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,23 @@ var List = new Class({
223223
return output;
224224
},
225225

226+
count: function (property, value)
227+
{
228+
var total = 0;
229+
230+
for (var i = 0; i < this.list.length; i++)
231+
{
232+
var child = this.list[i];
233+
234+
if (child[property] === value)
235+
{
236+
total++;
237+
}
238+
}
239+
240+
return total;
241+
},
242+
226243
swap: function (child1, child2)
227244
{
228245
if (child1 === child2)

0 commit comments

Comments
 (0)