-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
66 lines (57 loc) · 1.5 KB
/
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// console.log("hello");
// console.log(" "); // empty line
// console.log("world");
// see: http://stackoverflow.com/questions/11386492/accessing-line-number-in-v8-javascript-chrome-node-js
Object.defineProperty(global, '__stack', {
get: function(){
var orig = Error.prepareStackTrace;
Error.prepareStackTrace = function(_, stack){ return stack; };
var err = new Error;
Error.captureStackTrace(err, arguments.callee);
var stack = err.stack;
Error.prepareStackTrace = orig;
return stack;
}
});
Object.defineProperty(global, '__line', {
get: function(){
return __stack[1].getLineNumber();
}
});
function halp() {
console.log("Argument Count: "+arguments.length)
console.log(arguments);
console.log(" - - - - - - - -")
var keys = Object.keys(arguments);
console.log(keys)
console.log(" - - - - - - - -")
keys.map(function(a){
console.log(arguments[a]);
})
console.log(arguments.callee.caller.name)
var caller = arguments.callee.caller.toString()
console.log(caller)
clines = caller.split('\n');
console.log("Caller Lines:"+clines.length)
console.log(" ")
console.log(" - - - - - - - -")
for (var i = 1; i < clines.length - 1; i++) {
console.log(i + ' ' + clines[i]);
};
console.log(" - - - - - - - -")
console.log(" ")
// clines.map(function(line){
// if(line.indexOf('halp') > -1) {
// }
// })
}
function myfunk() {
var obj = {
"foo":"bar",
"this":"that"
}
halp('hello', "red", obj, __line);
}
// myfunk();
// console.log(__line);
module.exports = halp;