add amd2module test

This commit is contained in:
kekee000
2015-01-28 15:23:42 +08:00
parent 82515c449f
commit 1da142e333
4 changed files with 196 additions and 15 deletions

71
node/generated.js Normal file
View File

@@ -0,0 +1,71 @@
/**
* @file test-define.js
* @author mengke01(kekee000@gmail.com)
*/
// 测试define函数
module.exports = require('../common/test').test({
test1: 'test1',
test2: 'test2'
});
// 测试 string
module.exports = 'test string';
// 测试commonjs wrapper
module.exports = {
test1: 'test1',
test2: 'test2'
};
// 测试object
module.exports ={
test1: 'test1',
test2: 'test2'
};
// 测试多return
var string = require('../common/string');
if (string.pad) {
module.exports = string.pad;
}
else {
module.exports = function (str) {
return function () {
str;
};
};
}
// 测试 nodejs兼容写法
if (typeof exports !== 'undefined') {
module.exports = exports = require('xmldom').DOMParser;
}
else {
module.exports = window.DOMParser;
}