js-object-to-json
js-object-to-json copied to clipboard
Remove "var/const/let myObject = " and ";" at end of object
Lets say this is your JS object...
const myObject = {
"myPropertyA": "myValue",
"myPropertyB": "myValue"
};
The JS object minified will be...
constmyObject={"myPropertyA":"myValue","myPropertyB":"myValue"};
When I use this package, it does not remove the "constmyObject=" or the ";" line break at the end of the object.
This improvement will parse the final output string to remove keywords such as const. let, and var, remove variable names and equal operators before the object brackets {. This improvement will remove any semicolons the come after the object. And this improvement will remove any characters that come before and after the object in the final parsed string.
This will solve this issue I made earlier this year. https://github.com/ovidigital/js-object-to-json/issues/20