I wrote the function below to return all keys in an object that match a specific pattern. It seems really round-about because there\'s no filter function in lodash for objects,
I don't think you need lodash for this, I would just use Object.keys
, filter for matches then reduce back down to an object like this (untested, but should work):
export function keysThatMatch (pattern) {
return (data) => {
return Object.keys(data).filter((key) => {
return key.match(pattern);
}).reduce((obj, curKey) => {
obj[curKey] = data[curKey];
return obj;
});
}
}