UNPKG

@fluentui/react

Version:

Reusable React components for building web experiences.

25 lines 882 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.GetGroupCount = void 0; var tslib_1 = require("tslib"); /** * Takes an array of groups and returns a count of the groups and all descendant groups. * @param groups - The array of groups to count. */ var GetGroupCount = function (groups) { var total = 0; if (groups) { var remainingGroups = tslib_1.__spreadArray([], groups, true); 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; }; exports.GetGroupCount = GetGroupCount; //# sourceMappingURL=GroupedListUtility.js.map