Socket
Socket
Sign inDemoInstall

run-method

Package Overview
Dependencies
1
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    run-method

Run any function from any NodeJS module and pass arguments


Version published
Weekly downloads
0
Maintainers
1
Created
Weekly downloads
 

Readme

Source

run-method

Run any function from any NodeJS module and pass arguments

npx run-method SampleModule say_hello

Install (Optional)

npm install run-method

This will add run-method as dependency in the project.

Usage

npx run-method <module_name> <function_name> [ <arg> .. ]

Complete Example

npx run-method --debug maths factorial 5

Optionally, include the run-method in your code to control various levels of output:

# maths.js
const RunMethod = require('run-method');
const maths = {
    factorial(n) {
        n = parseInt(n);
        RunMethod.debug('input = ', n);
        let m = 1;
        for(let i = 1; i <= n; i++) m*= i;
        RunMethod.debug('output = ', m);
        return m;
    }
}
module.exports = maths;

Different levels of output functions:

RunMethod.output(); // Level 1 = reserved to display the return value
RunMethod.info();   // Level 2 = informational
RunMethod.debug();  // Level 3 = debug

Also, see help

npx run-method --help

FAQs

Last updated on 29 Mar 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc