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
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
There are some formatting differences between the code generated by swc and nodejs produces (by calling
.toString()
on the function).It might be better if
swc
can generate the same output as nodejs to maximize interoperability.Here are some differences I have found:
no space between
function
and()
, and extra line break and spacesindentation difference. Nodejs: 2 spaces in body and 4 spaces for closing, swc: 4 spaces in body and 8 spaces for closing
no space around arrow function
=>
extra space in object method:
array values in separate lines:
if/else in separate lines:
no space around while clause:
no space and semicolon in do-while:
no space around for-loop (same for for-in and for-of):
no space found switch clause and no extra line break between cases:
missing space after
finally
:extra space after
catch
without param:has parathesis for single param arrow function:
These come from the failed tests in https://github.com/unional/tersify/tree/swc-vs-node
Here are the two raw print out:
nodejs.txt
swc.txt
Beta Was this translation helpful? Give feedback.
All reactions