@squared-functions/module
Advanced tools
Comparing version 0.9.9 to 0.9.10
19
index.js
@@ -1,2 +0,2 @@ | ||
/* @squared-functions/module 0.9.9 | ||
/* @squared-functions/module 0.9.10 | ||
https://github.com/anpham6/squared-functions */ | ||
@@ -26,3 +26,3 @@ | ||
constructor() { | ||
this.tempDir = 'temp'; | ||
this.tempDir = 'tmp'; | ||
[this.major, this.minor, this.patch] = process.version.substring(1).split('.').map(value => +value); | ||
@@ -50,2 +50,5 @@ } | ||
} | ||
static isLocalPath(value) { | ||
return /^\.?\.[\\/]/.test(value); | ||
} | ||
supported(major, minor, patch = 0) { | ||
@@ -66,2 +69,14 @@ if (this.major < major) { | ||
} | ||
parseFunction(value) { | ||
if (Module.isLocalPath(value = value.trim())) { | ||
try { | ||
value = fs.readFileSync(path.resolve(value), 'utf8').trim(); | ||
} | ||
catch (err) { | ||
this.writeFail(['Could not load function', value], err); | ||
return null; | ||
} | ||
} | ||
return value.startsWith('function') ? eval(`(${value})`) : null; | ||
} | ||
getTempDir(subDir, filename = '') { | ||
@@ -68,0 +83,0 @@ return process.cwd() + path.sep + this.tempDir + path.sep + (subDir ? uuid.v4() + path.sep : '') + (filename.startsWith('.') ? uuid.v4() : '') + filename; |
{ | ||
"name": "@squared-functions/module", | ||
"version": "0.9.9", | ||
"version": "0.9.10", | ||
"description": "Module extension class for squared-functions", | ||
@@ -18,3 +18,3 @@ "main": "index.js", | ||
"dependencies": { | ||
"@squared-functions/types": "^0.9.9", | ||
"@squared-functions/types": "^0.9.10", | ||
"uuid": "^8.3.2", | ||
@@ -21,0 +21,0 @@ "chalk": "^4.1.0" |
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
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
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
9879
215
1