Gets the value from an Object's property using a provided Object property path. An empty
property name in the path fetches all keys in the current Object.

@param {String[]} pathArray - Array of properties to traverse through.
@param {Object} obj - Object to traverse.

@returns {*} Data that was fetched from the property.
function getDataFromPropPath(pathArray, obj) {
    if (pathArray.length === 0) {
        return undefined;
    }
    return pathArray.reduce((result, prop) => {
        if (typeof result !== 'object' || result === null) {
            return {};
        }
        if (prop === '') {
            return result;
        }
        return result[prop];
    }, obj);
}