MCPcopy Create free account
hub / github.com/phaserjs/phaser / CountAllMatching

Function CountAllMatching

src/utils/array/CountAllMatching.js:23–44  ·  view source on GitHub ↗
(array, property, value, startIndex, endIndex)

Source from the content-addressed store, hash-verified

21 * @return {number} The total number of elements with properties matching the given value.
22 */
23var CountAllMatching = function (array, property, value, startIndex, endIndex)
24{
25 if (startIndex === undefined) { startIndex = 0; }
26 if (endIndex === undefined) { endIndex = array.length; }
27
28 var total = 0;
29
30 if (SafeRange(array, startIndex, endIndex))
31 {
32 for (var i = startIndex; i < endIndex; i++)
33 {
34 var child = array[i];
35
36 if (child[property] === value)
37 {
38 total++;
39 }
40 }
41 }
42
43 return total;
44};
45
46module.exports = CountAllMatching;

Callers 1

Calls 1

SafeRangeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…