Add support for Asynchronous Module Definition (AMD) API

See http://requirejs.org/docs/whyamd.html
This commit is contained in:
Rodrigo González 2013-06-02 22:59:57 -03:00
parent 1fa788702f
commit 1b856de26c

View File

@ -1510,9 +1510,17 @@
if (typeof define === "function") {
// Add support for require.js
define(function(require, exports, module) {
exports.js_beautify = js_beautify;
});
if(typeof define.amd === "undefined") {
define(function(require, exports, module) {
exports.js_beautify = js_beautify;
});
} else {
// if is AMD ( https://github.com/amdjs/amdjs-api/wiki/AMD#defineamd-property- )
define([], function() {
return js_beautify;
});
}
} else if (typeof exports !== "undefined") {
// Add support for CommonJS. Just put this file somewhere on your require.paths
// and you will be able to `var js_beautify = require("beautify").js_beautify`.