/
githubmirror
/
wp-calypso
Обзор
Документация
Войти
/
githubmirror
/
wp-calypso
Код
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
trunk
client/blocks/comments/utils.jsx
15 строк
592 B
Griffith Chen
Lodash: replace no-default get() with optional chaining (#111865)
22 июн 2026, 12:26
Не верифицирован
22 июн 2026, 12:26
d97f6d2
Код
Авторство
О чём код?
/** * @param {Object} ancestor potential ancestor comment * @param {Object} child potential child comment * @param {Object} commentsTree commentsTree for a post, see associated getPostCommentsTree selector * @returns {boolean} return true if parent is an ancestor of child */ export const isAncestor = ( ancestor, child, commentsTree ) => { if ( ! ancestor || ! child || ! child.parent || ! commentsTree ) { return false; } const nextParent = commentsTree?.[ child.parent.ID ]?.data; return child.parent.ID === ancestor.ID || isAncestor( ancestor, nextParent, commentsTree ); };