Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for wildcard/array in json-prune
Add support for specially-named properties: `[]`, to iterate through all elements in an array, in order to deal more graciously with cases where the property to remove is an element in an array. An actual case: +js(json-prune, playlist.movies.0.adserver playlist.movies.1.adserver ...) Can be now converted to: +js(json-prune, playlist.movies.[].adserver) `*`, to iterate through all own properties of an object, in order to deal with random-named properties. For example (not an actual case): +js(json-prune, playlist.*.adserver) Where `adserver` would be a property member of an object which is itself a property of `playlist`, but which name is unknown or is variable.
- Loading branch information
f433932
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lain566 was this really an array? uBlockOrigin/uAssets#6955 uBlockOrigin/uAssets@8886726
I'm pretty sure this was working only on object with keys explicitly named as
"0"
,"1"
,"2"
, and not on real array without keys.Not easy to reproduce now, but it seems I'm right:
@gorhill bad exmple :/ ;) (updating wiki for json-prune now)
f433932
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad, I just looked at the filter and thought it was trying to index elements in an array, without further checking if this was really the case.