callsite-record
Advanced tools
Comparing version 3.0.1 to 3.0.2
@@ -19,2 +19,12 @@ var fs = require('fs'); | ||
// Utils | ||
function getFrameTypeName (frame) { | ||
// NOTE: this throws in node 10 for non-methods | ||
try { | ||
return frame.getTypeName(); | ||
} | ||
catch (err) { | ||
return null; | ||
} | ||
} | ||
function findClosestNonNativeAncestorFrameIdx (stackFrames, curIdx) { | ||
@@ -219,6 +229,7 @@ for (var i = curIdx + 1; i < stackFrames.length; i++) { | ||
for (var i = 0; i < stackFrames.length; i++) { | ||
var frame = stackFrames[i]; | ||
var isMemberCall = typeName && frame.getMethodName() === fnName && frame.getTypeName() === typeName; | ||
var frame = stackFrames[i]; | ||
var fnNameMatch = frame.getFunctionName() === fnName || frame.getMethodName() === fnName; | ||
var typeNameMatch = !typeName || getFrameTypeName(frame) === typeName; | ||
if (isMemberCall || frame.getFunctionName() === fnName) { | ||
if (fnNameMatch && typeNameMatch) { | ||
var callsiteFrameIdx = findClosestNonNativeAncestorFrameIdx(stackFrames, i); | ||
@@ -225,0 +236,0 @@ |
{ | ||
"name": "callsite-record", | ||
"version": "3.0.1", | ||
"version": "3.0.2", | ||
"description": "Create fancy log entries for errors and function call sites.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18412
293