Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
tj committed Oct 10, 2012
0 parents commit fa8da60
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
@@ -0,0 +1,2 @@
components
build
11 changes: 11 additions & 0 deletions Makefile
@@ -0,0 +1,11 @@

build: components index.js
@component build --dev

components:
@component install --dev

clean:
rm -fr build components template.js

.PHONY: clean
12 changes: 12 additions & 0 deletions Readme.md
@@ -0,0 +1,12 @@

# stack

Get a stack of `CallSite` objects

## Installation

$ component install component/stack

## License

MIT
12 changes: 12 additions & 0 deletions component.json
@@ -0,0 +1,12 @@
{
"name": "stack",
"repo": "component/stack",
"description": "Get a stack of CallSite objects",
"version": "0.0.1",
"keywords": ["stack", "error", "callsite", "debug"],
"dependencies": {},
"development": {},
"scripts": [
"index.js"
]
}
23 changes: 23 additions & 0 deletions index.js
@@ -0,0 +1,23 @@

/**
* Expose `stack()`.
*/

module.exports = stack;

/**
* Return the stack.
*
* @return {Array}
* @api public
*/

function stack() {
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;
}

0 comments on commit fa8da60

Please sign in to comment.