rsuite
Version:
A suite of react components
16 lines (15 loc) • 418 B
JavaScript
'use client';
;
exports.__esModule = true;
exports.getPathTowardsItem = getPathTowardsItem;
/**
* Returns an array indicating the hierarchy path from root towards `target` item
*/
function getPathTowardsItem(target, getParent) {
if (!target) return [];
var path = [target];
for (var parent = getParent(target); !!parent; parent = getParent(parent)) {
path.unshift(parent);
}
return path;
}