New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Array support #9
Comments
A PR would be great! I think it will require updating I tried with the following code with the latest versions of 'use strict';
const mm = require('micromatch');
const stringify = require('stringify-keys');
const obj = {
name: 'Peter',
familyName: 'Morlion',
hobbies: [{
name: 'Reading',
since: 1989
}, {
name: 'Games',
since: 1994
}]
};
const keys = stringify(obj, '/');
const patterns = ['name', 'hobbies/*/name'];
const matches = mm(keys, patterns);
console.log(matches);
|
I had a deeper look and think the solution lies in the set-value library. In glob-object, we have keys like If you're OK with that PR and it's merged, I can update glob-object and then filter-object to incorporate these changes :) |
Would you be interested in a PR for array support?
Say we have this object:
If I want to filter with
["name", "hobbies.name"]
I'll get:It would be nice to get:
The text was updated successfully, but these errors were encountered: