Skip to content
This repository was archived by the owner on Apr 16, 2019. It is now read-only.

Commit ebf7243

Browse files
committed
adding support for steal format
1 parent 7b29739 commit ebf7243

File tree

3 files changed

+31
-5
lines changed

3 files changed

+31
-5
lines changed

index.js

+11-5
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,21 @@ function extract(src) {
5555
AMD detection is based on a simple rule:
5656
- if `define()` is called
5757
**/
58-
context.define = function (name, fn, version, config) {
58+
context.define = function () {
5959
mods.push({
60-
type: 'amd',
61-
name: name,
62-
version: version,
63-
config: config
60+
type: 'amd'
6461
});
6562
};
6663

64+
/**
65+
Steal detection is based on a simple rule:
66+
- if `steal()` is called
67+
**/
68+
context.steal = function () {
69+
mods.push({
70+
type: 'steal'
71+
});
72+
};
6773

6874
/**
6975
CommonJS detection is based on simple rules:

test/detect.js

+14
Original file line numberDiff line numberDiff line change
@@ -91,4 +91,18 @@ describe('detect', function () {
9191

9292
});
9393

94+
95+
describe('steal', function () {
96+
97+
// iterating over the fixtures for all steal*.js
98+
Object.keys(fixtures).forEach(function (file) {
99+
if (file.indexOf('steal') === 0) {
100+
it('should detect `steal` for fixtures/' + file, function () {
101+
expect(detect(fixtures[file])).to.be.equal('steal');
102+
});
103+
}
104+
});
105+
106+
});
107+
94108
});

test/fixtures/steal.js

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
steal("foo", "bar", function(foo, bar){
2+
return {
3+
foo: foo,
4+
bar: bar
5+
};
6+
});

0 commit comments

Comments
 (0)