Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transform iife into iiafe #642

Closed
frzi opened this issue Aug 5, 2017 · 3 comments
Closed

Transform iife into iiafe #642

frzi opened this issue Aug 5, 2017 · 3 comments

Comments

@frzi
Copy link

frzi commented Aug 5, 2017

What are the thoughts of transforming iife to iiafe? (immediately invoked arrow function expressions)?

Input Code

(function () {
   /* ... */
})();

// or

(function () {
   /* ... */
}());

Transformed Code

(_=>{/*...*/})()
@frzi frzi changed the title Turn iife into iiafe Transform iife into iiafe Aug 5, 2017
@j-f1
Copy link
Contributor

j-f1 commented Aug 5, 2017

What about just a block?

{/*...*/}

@frzi
Copy link
Author

frzi commented Aug 5, 2017

Transforming iifes into a simple block would work for iife at top level, without any arguments.

But a little trickier otherwise, I think(?).

let dynamicClass = (function ($) {
    function MyClass() {}
    MyClass.$ = $
    return MyClass
})(jQuery)

which now transform to:

let dynamicClass=function(a){function b(){}return b.$=a,b}(jQuery);

With an iiafe:

let dynamicClass=(a=>{function b(){}return b.$=a,b})(jQuery);

@boopathi
Copy link
Member

boopathi commented Aug 6, 2017

This has already been brought up. There is an issue for that already - #428 . Closing this and tracking it there.

@boopathi boopathi closed this as completed Aug 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants