jugglinmike / amdclean

An AMD build tool that converts AMD code to standard JavaScript
http://gregfranko.com/amdclean/
MIT License
5 stars 0 forks source link

Eliminate unnecessary functions for literals. #4

Closed tbranyen closed 10 years ago

tbranyen commented 10 years ago

defines that use literals should not be converted to IIFE that return the value, we should just directly assign.

Example:

define(1234);

which currently compiles to:

var __AMDCLEAN0__ = (function() {
  return 1234;
})();

but, should be optimized to:

var __AMDCLEAN0__ = 1234;
jugglinmike commented 10 years ago
define(function() {
  return function() {
    /* my function */
  });
});

Could also be optimized:

var __AMDCLEAN0__ = function() {
  /* my function */
};
jugglinmike commented 10 years ago

Forget it!