Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@plumier/reflect

Package Overview
Dependencies
Maintainers
1
Versions
252
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@plumier/reflect - npm Package Compare versions

Comparing version 1.1.2-canary.1 to 1.1.2-canary.2

13

lib/parser.js

@@ -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"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc