Neater way to filter Object containing other Objects by value
<p>I've got a JavaScript object that looks like this:</p>

<pre><code>var options = { 
    'user1' : { 'house1' : ["lat1", "lng1"] },
    'user2' : { 'house2' : ["lat2", "lng2"] },
    'user3' : { 'house1' : ["lat3", "lng3"] }
};
</code></pre>

<p>Say I want to look up all the users associated with <code>house1</code>, and return an array of their usernames and their positions. </p>

<p>What's the clearest and most efficient way to do this?</p>

<p>Currently I've written a rather unwieldy custom lookup, as follows:</p>

<pre><code>function returnByValues(options, housenum):
    var results = [];
    for (var username in options) { 
        var properties = options[username];
        for (var housekey in properties) { 
            if (housekey === housenum) { 
                var result = {};
                result[username] = properties;
                results.push(result);
            }
        }
    } 
    return results;
</code></pre>

<p>Is there a neater way? It's not exactly readable code!</p>
