Merge pull request #49 from alexanderGugel/umd

Add UMD
This commit is contained in:
Christopher Chedeau
2015-02-12 12:41:53 -08:00

View File

@@ -8,7 +8,6 @@
*/ */
var computeLayout = (function() { var computeLayout = (function() {
function capitalizeFirst(str) { function capitalizeFirst(str) {
return str.charAt(0).toUpperCase() + str.slice(1); return str.charAt(0).toUpperCase() + str.slice(1);
} }
@@ -653,7 +652,21 @@ var computeLayout = (function() {
}; };
})(); })();
if (typeof module === 'object') { // UMD (Universal Module Definition)
module.exports = computeLayout; // See https://github.com/umdjs/umd for reference
} (function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define([], factory);
} else if (typeof exports === 'object') {
// Node. Does not work with strict CommonJS, but
// only CommonJS-like environments that support module.exports,
// like Node.
module.exports = factory();
} else {
// Browser globals (root is window)
root.returnExports = factory();
}
}(this, function () {
return computeLayout;
}));