enhanced-require
enhanced-require copied to clipboard
Fix #6 Now you can also return value from define function like can be done with require.js
For example
define(function(require, exports, module){
var logic = {
a: 3
}
return logic;
});
will now work.
But this will continue to work too
define(function(require, exports, module){
var logic = {
a: 3
}
exports.a= logic.a;
});
@sokra Please merge this and add publish to npm. Thanks
Doesn't it make more sense to check if the return value !== undefined
instead of testing for an empty object.
Please write a test case.
No because is easier for some function to return something by mistake, than set a property on exports variable. Ok, I will try to make a test (:
@sokra Added the tests
Could add a test that a empty module returns an empty object:
define(function(require, exports, module){
});
should be {}
@sokra Added, also allows to return falsy values.
Ok, I've made the changes.