function size(parentNode) {
    let sum = 0;
    parentNode.forEach((node) => {
        sum = sum + size(node);
    })
    return sum + parentNode.size;
}
Recursively loop over entire tree and return sum of nodes

@since 3.8.0

@param {map} parentNode current map instance, current directory
@returns {int} sum of all children nodes