0.1.7 • Published 7 months ago

main-function v0.1.7

Weekly downloads
4
License
MIT
Repository
github
Last release
7 months ago

NPM Package Build Status

Main Function

A simple wrapper that handles error and return code.

Install

yarn add main-function

Usage

import main, {ProgramError} from 'main-function';

main(async (args: string[]) => {
  // Throw an `ProgramError` to exit:
  throw new ProgramError(0, 'Some friendly error message');

  // Or throw a normal error (will print error stack and exit with code `1`):
  throw new Error():

  // Optional return statement for exit code:
  return 0;
});

License

MIT License.