프로젝트

일반

사용자정보

통계
| 개정판:

root / HServer / 00.Server / 00.Program / node_modules / callsite / Readme.md

이력 | 보기 | 이력해설 | 다운로드 (631 Bytes)

1 39 HKM
# callstack
2
3
  Access to v8's "raw" `CallSite`s.
4
5
## Installation
6
7
    $ npm install callsite
8
9
## Example
10
11
```js
12
var stack = require('callsite');
13
14
foo();
15
16
function foo() {
17
  bar();
18
}
19
20
function bar() {
21
  baz();
22
}
23
24
function baz() {
25
  console.log();
26
  stack().forEach(function(site){
27
    console.log('  \033[36m%s\033[90m in %s:%d\033[0m'
28
      , site.getFunctionName() || 'anonymous'
29
      , site.getFileName()
30
      , site.getLineNumber());
31
  });
32
  console.log();
33
}
34
```
35
36
## Why?
37
38
  Because you can do weird, stupid, clever, wacky things such as:
39
40
  - [better-assert](https://github.com/visionmedia/better-assert)
41
42
## License
43
44
  MIT