Recursively collect values for property using lodash
<p>For a nested complex object or array, I would like to collect all values for a given property name. Example:</p>

<pre><code>var structure = {
    name: 'alpha',
    array: [
        { name: 'beta' },
        { name: 'gamma' }
    ],
    object: {
        name: 'delta',
        array: [
            { name: 'epsilon' }
        ]
    }
};

// expected result:  [ 'alpha', 'beta', 'gamma', 'delta', 'epsilon' ]
</code></pre>

<p>It's obvious how to achieve this using plain JS, but: Is there any elegant, concise approach using lodash?</p>

<p>[edit] Current variant below. Nicer solutions welcome!</p>

<pre><code>function getPropertyRecursive(obj, property) {
    var values = [];
    _.each(obj, function(value, key) {
        if (key === property) {
            values.push(value);
        } else if (_.isObject(value)) {
            values = values.concat(getPropertyRecursive(value, property));
        }
    });
    return values;
}
</code></pre>