0.0.1 • Published 6 years ago

@yao-js/run-main v0.0.1

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

Run Main

Run js main function.

Features

  • Run sync/async function directly
  • Exit after execution
  • Catch and log uncaught error (and exit)
  • Print start/finish logs

Install

npm install @yao-js/run-main

Usage

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

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

runMain(main);

API

async runMain(mainFn, options)

  • mainFn: async function(...args)
  • options: Object
    • quiet?=false: Boolean // if true, start/end messages won't be printed
    • logger?=console: Logger

License

MIT