Comparing version 2.3.6 to 2.3.7
10
loupe.js
@@ -312,2 +312,3 @@ (function (global, factory) { | ||
var functionNameMatch = /\s*function(?:\s|\s*\/\*[^(?:*\/)]+\*\/\s*)*([^\s\(\/]+)/; | ||
var maxFunctionSourceLength = 512; | ||
function getFuncName(aFunc) { | ||
@@ -320,4 +321,11 @@ if (typeof aFunc !== 'function') { | ||
if (typeof Function.prototype.name === 'undefined' && typeof aFunc.name === 'undefined') { | ||
// eslint-disable-next-line prefer-reflect | ||
var functionSource = toString.call(aFunc); | ||
// To avoid unconstrained resource consumption due to pathalogically large function names, | ||
// we limit the available return value to be less than 512 characters. | ||
if (functionSource.indexOf('(') > maxFunctionSourceLength) { | ||
return name; | ||
} | ||
// Here we run a polyfill if Function does not support the `name` property and if aFunc.name is not defined | ||
var match = toString.call(aFunc).match(functionNameMatch); | ||
var match = functionSource.match(functionNameMatch); | ||
if (match) { | ||
@@ -324,0 +332,0 @@ name = match[1]; |
{ | ||
"name": "loupe", | ||
"version": "2.3.6", | ||
"version": "2.3.7", | ||
"description": "Inspect utility for Node.js and browsers", | ||
@@ -101,3 +101,3 @@ "homepage": "https://github.com/chaijs/loupe", | ||
"dependencies": { | ||
"get-func-name": "^2.0.0" | ||
"get-func-name": "^2.0.1" | ||
}, | ||
@@ -104,0 +104,0 @@ "devDependencies": { |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
58140
1391
0
1
Updatedget-func-name@^2.0.1