office-ui-fabric-react
Version:
Reusable React components for building experiences for Office 365.
24 lines • 930 B
JavaScript
define(["require", "exports"], function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
* Takes an array of groups and returns a count of the groups and all descendant groups.
* @param groups - The array of groups to count.
*/
exports.GetGroupCount = function (groups) {
var total = 0;
if (groups) {
var remainingGroups = groups.slice();
var currentGroup = void 0;
while (remainingGroups && remainingGroups.length > 0) {
++total;
currentGroup = remainingGroups.pop();
if (currentGroup && currentGroup.children) {
remainingGroups.push.apply(remainingGroups, currentGroup.children);
}
}
}
return total;
};
});
//# sourceMappingURL=GroupedListUtility.js.map