@plumier/reflect
Advanced tools
Comparing version 1.1.2-canary.1 to 1.1.2-canary.2
@@ -60,8 +60,15 @@ "use strict"; | ||
return "class DynamicClass {}"; | ||
// in case function inside object, it will cause error | ||
// in case function property used in an object | ||
// example | ||
// const obj = { fn: function(par1) {} } | ||
// reflect(obj.fn) | ||
// regex search for | ||
if (functionOnly && code.search(/^(async\b\s*)?function\s*\((?:[^)(]+|\((?:[^)(]+|\([^)(]*\))*\))*\)\s*{/gm) > -1) | ||
return code.replace("function", "function _"); | ||
// in case inline function | ||
// const obj = { fn(par1) {} } | ||
// reflect(obj.fn) | ||
if (functionOnly && code.search(/^([A-z0-9]+)\s*\((?:[^)(]+|\((?:[^)(]+|\([^)(]*\))*\))*\)/gm) > -1) | ||
if (functionOnly && code.search(/^([A-z0-9]+)\s*\((?:[^)(]+|\((?:[^)(]+|\([^)(]*\))*\))*\)\s*(?!=>){/gm) > -1) | ||
return `function ${code}`; | ||
// in case inline async function | ||
// const obj = { async fn(par1) {} } | ||
if (functionOnly && code.search(/^async\s*([A-z0-9]+)\s*\((?:[^)(]+|\((?:[^)(]+|\([^)(]*\))*\))*\)/gm) > -1) | ||
@@ -68,0 +75,0 @@ return code.replace("async", "async function"); |
{ | ||
"name": "@plumier/reflect", | ||
"version": "1.1.2-canary.1+c9bc774", | ||
"version": "1.1.2-canary.2+1e6f54e", | ||
"description": "Plumier reflection module", | ||
@@ -42,3 +42,3 @@ "main": "lib/index.js", | ||
}, | ||
"gitHead": "c9bc7742f7f3f4e910fb3f097a1f5d5780ae2442" | ||
"gitHead": "1e6f54e893c16778115750d2f3683464958b7977" | ||
} |
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
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the 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
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
82683
1493