Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@blackglory/go

BlackGlory5.1kMIT2.0.0TypeScript support: included

sh npm install --save @blackglory/go # or yarn add @blackglory/go

readme

go

Install

npm install --save @blackglory/go
# or
yarn add @blackglory/go

Usage

import { go } from '@blackglory/go'

go(async () => {
  ...
})

Why?

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 () => {
  ...
})()

API

go

function go<T>(fn: () => T): T

goMicrotask

function goMicrotask<T>(fn: () => Awaitable<T>): Promise<T>

goMarcotask

function goMarcotask<T>(fn: () => Awaitable<T>): Promise<T>

goGenerator

function goGenerator<Yield, Next>(
  fn: () =>
  | void
  | Generator<Yield, void, Next>
): Generator<Yield, void, Next>

goAsyncGenerator

function goAsyncGenerator<Yield, Next>(
  fn: () =>
  | void
  | Generator<Yield, void, Next>
  | AsyncGenerator<Yield, void, Next>
): AsyncGenerator<Yield, void, Next>

changelog

Changelog

All notable changes to this project will be documented in this file. See standard-version for commit guidelines.

2.0.0 (2024-04-17)

⚠ BREAKING CHANGES

    • It requires Node.js >= v18.17.0
  • CommonJS => ESM

Features

  • add goGenerator, goAsyncGenerator (d135630)

1.1.3 (2023-06-11)

Bug Fixes

1.1.2 (2022-08-01)

1.1.1 (2022-06-09)

Bug Fixes

  • export goMicrotask, goMacrotask (a14a05b)

1.1.0 (2022-06-09)

Features

  • add goMicrotask, goMacrotask (c3ab12e)

1.0.0 (2022-03-05)

0.1.1 (2021-12-04)

0.1.0 (2021-03-07)

Features