get-caller-file
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -8,3 +8,3 @@ 'use strict'; | ||
module.exports = function getCallerFile() { | ||
module.exports = function getCallerFile(_position) { | ||
var oldPrepareStackTrace = Error.prepareStackTrace; | ||
@@ -15,6 +15,8 @@ Error.prepareStackTrace = function(err, stack) { return stack; }; | ||
var position = _position ? _position : 2; | ||
// stack[0] holds this file | ||
// stack[1] holds where this function was called | ||
// stack[2] holds the file we're interested in | ||
return stack[2] ? stack[2].getFileName() : undefined; | ||
return stack[position] ? stack[position].getFileName() : undefined; | ||
}; |
{ | ||
"name": "get-caller-file", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
3769
43