forked from lucalanca/angular-architecture-graph
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
37 lines (30 loc) · 786 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*eslint no-unused-expressions: 0, no-unused-vars: 0, no-eval: 0*/
"use strict";
// angular-architecture-graph
module.exports = function(scripts, options) {
var angular = require("./src/fake-angular")(options),
// shadow the globals
document = {},
window = {},
navigator = {};
var results = scripts.map(function(content, i) {
try {
// this is where the magic happens
eval(content.text);
} catch (e) {
return {
id: content.id,
error: true,
exception: e
};
}
return {
id: content.id,
error: false
};
});
return {
angular: angular,
results: results
};
};