Skip to content
This repository has been archived by the owner on Jul 25, 2023. It is now read-only.

Commit

Permalink
Merge pull request #4 from mangalam-research/amd-support
Browse files Browse the repository at this point in the history
Fix for supporting AMD-style modules.
  • Loading branch information
cimi committed May 19, 2013
2 parents 8386dfb + 3707808 commit 4e8870e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions patterns.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,12 @@ var traverse = function (node) {
return result ? false : true;
});
return result;
} else if (node.args && node.args.length) {
node.args.every(function (n) {
result = traverse(n);
return result ? false : true;
});
return result;
} else if (node.body) {
return traverse(node.body);
} else if (node.expression) {
Expand Down
3 changes: 3 additions & 0 deletions test/fixtures/amd.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
define(function (require, exports, module) {
exports.version = "0.9.0";
});
1 change: 1 addition & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ test('reading version numbers from simple text fixtures', function (t) {
t.equal(getVersion('fixtures/assigned.js'), '0.0.7', "module.exports.version assignment");
t.equal(getVersion('fixtures/literal.js'), '0.10.29', "object literal returned from a module function");
t.equal(getVersion('fixtures/assigned-literal.js'), '7.7.7', "object literal assigned to exports");
t.equal(getVersion('fixtures/amd.js'), '0.9.0', "object literal assigned to exports in AMD-style module");
t.end();
});

Expand Down

0 comments on commit 4e8870e

Please sign in to comment.