@zhaoyao91/run-main

0.0.2 • Public • Published

Run Main

Run js main function.

Features

  • Run sync/async function
  • Exit after execution
  • Log uncaught error
  • Prepare intuitive command args

Install

npm install @zhaoyao91/run-main

Usage

const runMain = require("@zhaoyao91/run-main");

async function main(...args) {
  // ...
}

runMain(main);

API

runMain(mainFn, options?)

  • mainFn: async function(...args)
  • options.logError?: function(error), default to console.error
  • options.forceExit?: boolean, default to false

License

MIT

Dependencies (0)

    Dev Dependencies (3)

    Package Sidebar

    Install

    npm i @zhaoyao91/run-main

    Weekly Downloads

    6

    Version

    0.0.2

    License

    MIT

    Unpacked Size

    1.74 kB

    Total Files

    3

    Last publish

    Collaborators

    • zhaoyao91