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
{{ message }}
This repository was archived by the owner on Jan 25, 2022. It is now read-only.
With the proposal, Function("a", "b", "c").toString() generates the following string:
function anonymous(a,b
) {c
}
but it doesn't match to existing implementations.
Firefox
function anonymous(a, b) {
c
}
Chrome
function anonymous(a,b
/**/) {
c
}
Safari
function anonymous(a, b) {
c
}
Edge
function anonymous(a,b) {
c
}
So, the main differences are:
LF before body is removed in the proposal
LF after parameters is added in the proposal, except Chrome
Question 1.
Is there any good reason to remove LF before body?
putting LF there should give us better string representation, and matches to existing implementations.
Question 2.
About LF after parameters, If I understand correctly, it's there to make toString result not SyntaxError when parameter contains "//". But it's necessary only in the case.
How about putting LF only if necessary? (it will introduce additional complexity tho...)