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

run-func

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

run-func - npm Package Compare versions

Comparing version 1.0.5 to 1.1.4

24

index.js

@@ -15,10 +15,20 @@ #! /usr/bin/env node

const userModule = require(path.join(process.cwd(), process.argv[2]));
const isEs6 = path.extname(process.argv[2]) === '.mjs';
if (isEs6) {
import('file://' + path.resolve(path.join(process.cwd(), process.argv[2]))).then((userModule) => {
executeInModule(userModule, process.argv[3], params);
});
} else {
const userModule = require(path.join(process.cwd(), process.argv[2]));
executeInModule(userModule, process.argv[3], params);
}
if (!userModule) {
throw new Error(`Module ${userModule} does not exists`);
function executeInModule(userMod, fnName, fnParams) {
if (!userMod) {
throw new Error(`Module ${userMod} does not exists`);
}
if (!userMod[fnName]) {
throw new Error(`Function ${fnName} is not present or exported from module ${userMod}`);
}
userMod[fnName](...fnParams);
}
if (!userModule[process.argv[3]]) {
throw new Error(`Function ${process.argv[3]} is not present or exported from module ${userModule}`);
}
userModule[process.argv[3]](...params);

@@ -15,10 +15,20 @@ #! /usr/bin/env node --max-old-space-size=4096

const userModule = require(path.join(process.cwd(), process.argv[2]));
const isEs6 = path.extname(process.argv[2]) === '.mjs';
if (isEs6) {
import('file://' + path.resolve(path.join(process.cwd(), process.argv[2]))).then((userModule) => {
executeInModule(userModule, process.argv[3], params);
});
} else {
const userModule = require(path.join(process.cwd(), process.argv[2]));
executeInModule(userModule, process.argv[3], params);
}
if (!userModule) {
throw new Error(`Module ${userModule} does not exists`);
function executeInModule(userMod, fnName, fnParams) {
if (!userMod) {
throw new Error(`Module ${userMod} does not exists`);
}
if (!userMod[fnName]) {
throw new Error(`Function ${fnName} is not present or exported from module ${userMod}`);
}
userMod[fnName](...fnParams);
}
if (!userModule[process.argv[3]]) {
throw new Error(`Function ${process.argv[3]} is not present or exported from module ${userModule}`);
}
userModule[process.argv[3]](...params);

@@ -25,3 +25,3 @@ {

},
"version": "1.0.5",
"version": "1.1.4",
"repository": {

@@ -28,0 +28,0 @@ "type": "git",

@@ -0,0 +0,0 @@ # run-func

Sorry, the diff of this file is not supported yet

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