11 lines
275 B
JavaScript
11 lines
275 B
JavaScript
export function contains(parent, child) {
|
|
const parentKey = parent.key;
|
|
// eslint-disable-next-line no-unmodified-loop-condition
|
|
while (child) {
|
|
if (child.key === parentKey)
|
|
return true;
|
|
child = child.parent;
|
|
}
|
|
return false;
|
|
}
|