0.0.2 • Published 7 years ago
supermain v0.0.2
supermain
A wrapper for async functions that makes it easier to write simple node scripts using async/await.
API
supermain()
const supermain = require('supermain');
supermain(async () => {
// something async in here
});If the asynchronous function rejects, supermain will print the error stack to stderr and terminate the process with exit code 1.
supermain.makePromisesSafe()
const supermain = require('supermain').makePromisesSafe();Calling .makePromisesSafe() triggers the same print-and-terminate behaviour on any unhandled rejection. Inspired by the fundamental make-promises-safe.
Compatibility
supermain works with both modern async functions from ES6 and functions that explicitely return Promises. Compatible with all Node.js versions >= 6.4.0.
License
0.0.2
7 years ago