terriajs
Version:
Geospatial data visualization platform.
23 lines (19 loc) • 710 B
JavaScript
;
var defined = require('terriajs-cesium/Source/Core/defined');
/**
* Return the ancestors in the data catalog of the given catalog member, recursively using "member.parent".
* The "Root Group" is not included.
*
* @param {CatalogMember} member The catalog member.
* @return {CatalogMember[]} The members' ancestors in its parent tree, starting at the top, not including this member.
*/
function getAncestors(member) {
var parent = member.parent;
var ancestors = [];
while (defined(parent) && defined(parent.parent)) {
ancestors = [parent].concat(ancestors);
parent = parent.parent;
}
return ancestors;
}
module.exports = getAncestors;