babel-plugin-transform-strip-amd-declarations
v0.0.1
Published
Strips AMD declarations to "export" inner declarations in e.g. jsdocs
Downloads
5
Maintainers
Readme
babel-plugin-deamdify
Strips AMD declarations to "export" inner declarations with jsdocs
— hey, google closure compiler, we have written jsdocs for our AMD-based code, maybe you can validate it?
define('math', [], function () {
/** @constructor */
function Math () {}
/**
* @param {number} a
* @param {number} b
* @return {number}
*/
Module.prototype.pow = function (a, b) {
var m = 1;
while (b--) m *= a;
return m;
};
return Math;
});
define('module', ['math'], function (Math) {
var math = new Math();
/** @constructor */
function Module () {}
/**
* @param {number} a
* @param {number} b
* @return {number}
*/
Module.prototype.method = function (a, b) {
return math.pow(a, b);
};
return Module;
});
— sorry, I can't validate math in the second module, because it's declared inside another scope — Okay, I'll transform them with babel plugin for you
See discussion on stackoverflow for some more details and tests for examples of transformations