You could use reduce again to achieve that in plain JavaScript:
var filtered = Object.keys(dict).reduce(function (filtered, key) {
if (dict[key] > 1) filtered[key] = dict[key];
return filtered;
}, {});
With some ES6 features, such as arrow functions, spread syntax, Object.entries, … it can look like this:
var filtered = Object.assign({}, ...
Object.entries(dict).filter(([k,v]) => v>1).map(([k,v]) => ({[k]:v}))
);
Or using the newer Object.fromEntries:
var filtered = Object.fromEntries(Object.entries(dict).filter(([k,v]) => v>1));
Using Lodash
There were a few issues with your attempt with lodash:
_.findis not intended for returning an object that takes a selection of key/values from a given object. You would need_.pickByfor that.- Your object values do not have a
frecuencyproperty; they are primitive values, so you should just have to returnuser > 1
Lodash code:
var filtered = _.pickBy(dict, function(user) {
return user > 1;
});