loop with lodash to guard against 'undefined has no property...' errors