forked from mdevils/node-sibling
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
22 lines (21 loc) · 665 Bytes
/
index.js
File metadata and controls
22 lines (21 loc) · 665 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
var Sibling = require('./lib/sibling');
(function() {
var siblings = {};
module.exports = {
declare: function(classDecl) {
var err = new Error(),
errLines = err.stack.split('\n');
errLines.shift();
errLines.shift();
var match = (/\(([^:]+):(\d+)/g).exec(errLines.shift()),
filename = match[1],
line = match[2],
sibling = new Sibling(filename, line, classDecl);
siblings[sibling.getId()] = sibling;
return sibling;
},
getById: function(id) {
return siblings[id];
}
};
})();