npm install --save @blackglory/go
# or
yarn add @blackglory/goimport { go } from '@blackglory/go'
go(async () => {
...
})IIFE is good until you forget to invoke it:
;(async () => {
...
}) // oops!The semicolon-free style is good until you forget to add a semicolon before the IIFE:
const arr = []
// oops!
(async () => {
...
})()function go<T>(fn: () => T): Tfunction goMicrotask<T>(fn: () => Awaitable<T>): Promise<T>function goMarcotask<T>(fn: () => Awaitable<T>): Promise<T>function goGenerator<Yield, Next>(
fn: () =>
| void
| Generator<Yield, void, Next>
): Generator<Yield, void, Next>function goAsyncGenerator<Yield, Next>(
fn: () =>
| void
| Generator<Yield, void, Next>
| AsyncGenerator<Yield, void, Next>
): AsyncGenerator<Yield, void, Next>