An atom package that converts the syntax between object literal notation and function statement notation (sometimes called constructor).
Normally, when you convert a JS object you need to complete two steps:
This package helps with the tedious work of the first step by automating it. The decisions of the second step still needs to be done manually by you.
or
Additionally, you can access the convert command through the Packages option in the menu bar, or the text editor's contextmenu.
Install the package through the Atom Editor itself:
Install Atom
In your terminal of choice, type:
apm install js-object-notation-converter
to install the latest version.
This package will not auto-correct syntax for you. If the syntax is wrong, the output will (most likely), be wrong also.
As mentioned above, code that is legal in one notation, but not the other (e.g. comparison expressions in the objects root scope), will be ignored. You must manually decide what to do with this code. This package only converts syntax.
The exception to the above is private functions which will be made public in the "constructor -> literal" conversion (thats how object literals work after all).
function calc() {} -> calc: function() {}
(NB! running the conversion again after converting from constructor to literal will not make previous private functions private again - use ctrl-z (undo) instead; to achieve this.)
Good catch. Let us know what about this package looks wrong to you, and we'll investigate right away.