And I should stop commenting the first thing that comes into my head, hasOwnProperly as you used is safer, was just doing the wrong check

        if (typeof item[key] === 'object' &&
            item[key].hasOwnProperty('duration')) {