Currently, I am reviewing some code that includes unnecessary square bracket notations. To improve code comprehension, my aim is to transform instances like
abc[3]['prop']["subprop"]
into abc[3].prop.subprop
.
I have been able to achieve this to a large extent by performing text replacements in VSCode multiple times using regex
([\w_$][\w$_\d]*(?:(?:\[\d+\])+)?)\[["']([\w_$][\w$_\d]*)["']\]
and replacing it with $1.$2
.
However, I also wish to convert
{ 'prop': value1, "prop2": value2 }
into { prop: value1, prop2: value2 }
. Is there a tool or extension available that can help me accomplish both of these transformations seamlessly?