Copy link to clipboard
Copied
!Consider following code
var a = 123;
var b = a === 123 ? 345 === 566 ? 123 : 444 : 567 === 567 ? 678 : 789;
alert(b)
This code excutes in chorme works.
However, it break in illustrator script !
The reason why I use such complex "if else", is because I use webpack UglifyJSPlugin to minify my script.
UglifyJSPlugin compiles my code to such complex "if else".
Is there any way to fix this ?
Is there any plugin I can use to transpile this code to normal if else ?
Thank you very much !
Hey, other forum forward me this babel plugin
This is exactly what I'm looking for.
Copy link to clipboard
Copied
Hi JosephWang​,
sorry. I don't like such minimized codes. Hard to read and almost impossible to find mistakes in these codes.
But I think "Adobe Extendscript" is not Javascipt. Please try one of these slightly less minimized versions.
var a = 123;
var b = (a === 123 ? (345 === 566 ? 123 : 444) : (567 === 567 ? 678 : 789));
alert(b);
Is this the result you want?
If not - please ask Kukurykus​ from PS-Scripting forum. He almost write all of his codes in this minimized kind.
Copy link to clipboard
Copied
Hi, I totally agree with you.
I think I need to rethink about my question more time.
Thank you for your reply.
Copy link to clipboard
Copied
Only for interest: what result should it be?
Copy link to clipboard
Copied
Hey, other forum forward me this babel plugin
This is exactly what I'm looking for.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now