Skip to content

UMD Fixes, transformAMDChecks option, Minor Optimizations,

Compare
Choose a tag to compare
@gfranko gfranko released this 18 Mar 03:31
· 108 commits to master since this release

UMD Factory Function Support

This:

(function (factory) {
    if (typeof exports === 'object') {
        module.exports = factory(require('backbone'), require('underscore'));
    } else if (typeof define === 'function' && define.amd) {
        define(['backbone', 'underscore'], factory);
    }
}(function (Backbone, _) {
    Backbone.Validation = (function(_){/*plugin logic*/}(_));
    return Backbone.Validation;
}));

Get's Converted To:

(function (factory) {
        if (typeof exports === 'object') {
            module.exports = factory(amdclean['backbone'], amdclean['underscore']);
        } else if (true) {
            amdclean['backbonevalidation'] = function (backbone, underscore) {
                return factory(backbone, underscore);
            }(amdclean['backbone'], amdclean['underscore']);
        }
    }(function (Backbone, _) {
        Backbone.Validation = (function(_){/*plugin logic*/}(_));
        return Backbone.Validation;
}));

New transformAMDChecks Option

If set to false, no conditional AMD checks will be transformed. This is a very helpful option for library authors.

Minor Optimizations

Callback parameters are no longer specified unnecessarily.