Include undefined on findClosestParent return types and update the function

This commit is contained in:
Matheus B
2024-01-16 20:01:03 -03:00
parent bf1edd99f9
commit 02246f64d2

View File

@@ -70,7 +70,7 @@ const drawText = (txt) => {
* the one farther down the graph, since that means it is closer to its child.
*
* @param {string[]} parents
* @returns {string}
* @returns {string | undefined}
*/
const findClosestParent = (parents) => {
let closestParent = '';
@@ -84,7 +84,7 @@ const findClosestParent = (parents) => {
}
});
return closestParent;
return closestParent || undefined;
};
/**