You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd like to remove a property with a specific name from an object. For example given:
constx={numprop: 3,// important comment about the numpropfilter: {test: "hi",},objprop: {a: "a"},}
I'd like to remove the filter property and end up with:
constx={numprop: 3,// important comment about the numpropobjprop: {a: "a"},}
My first attempt was grasp 'obj.props[key=#filter]' -R '' but this leaves an extra comma where the property was removed.
I also tried grasp 'obj! > prop[key=#filter]' -R '{\n{{.props[key!=#filter] | join ",\n" }}\n}' which does work, but since it rewrites the whole object it also removes any comments on the parts of the object I want to keep. Is there an alternative to avoid this?
The text was updated successfully, but these errors were encountered:
I'd like to remove a property with a specific name from an object. For example given:
I'd like to remove the
filter
property and end up with:My first attempt was
grasp 'obj.props[key=#filter]' -R ''
but this leaves an extra comma where the property was removed.I also tried
grasp 'obj! > prop[key=#filter]' -R '{\n{{.props[key!=#filter] | join ",\n" }}\n}'
which does work, but since it rewrites the whole object it also removes any comments on the parts of the object I want to keep. Is there an alternative to avoid this?The text was updated successfully, but these errors were encountered: