source/node/tools/searching-instance.js
function findGroupsByCheck(groups, compareFn) {
    var foundGroups = groups.filter(compareFn);
    groups.forEach(function(group) {
        var subFound = findGroupsByCheck(group.getGroups(), compareFn);
        if (subFound.length > 0) {
            foundGroups = foundGroups.concat(subFound);
        }
    });
    return foundGroups;
}
function findGroupsByCheck(groups, compareFn) {
    var foundGroups = groups.filter(compareFn);
    groups.forEach(function(group) {
        var subFound = findGroupsByCheck(group.getGroups(), compareFn);
        if (subFound.length > 0) {
            foundGroups = foundGroups.concat(subFound);
        }
    });
    return foundGroups;
}
function findGroupsByCheck ( groups , compareFn ) { var foundGroups = groups . filter ( compareFn ) ; groups . forEach ( function ( group ) { var subFound = findGroupsByCheck ( group . getGroups ( ) , compareFn ) ; if ( subFound . length > 0 ) { foundGroups = foundGroups . concat ( subFound ) ; } } ) ; return foundGroups ; }
Find group instances within groups that satisfy some check
@param {Array.<Group>} groups The groups to check within
@param {Function} compareFn A comparision function - return true to keep, false to strip
@returns {Array.<Group>} An array of found groups
Find group instances within groups that satisfy some check