CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-swc--helpers

Runtime helper functions for JavaScript and TypeScript transformations performed by the SWC compiler.

Pending
Overview
Eval results
Files

async-generators.mddocs/

Async and Generator Helpers

Implementation of async/await syntax and generator functions for older JavaScript environments that don't support these features natively.

Capabilities

Async Function Helpers

_async_to_generator

Converts async functions to generator-based implementations for older environments.

/**
 * Converts async functions to generator-based implementations
 * @param {Function} fn - The async function to convert
 * @returns {Function} Function that returns a Promise
 */
function _async_to_generator(fn): Function;

Usage Example:

const asyncFn = _async_to_generator(function* () {
  const result = yield fetch('/api/data');
  return result.json();
});

// Usage
asyncFn().then(data => console.log(data));

_await_value

Handles await expressions in transformed async functions.

/**
 * Handles await expressions in transformed async functions
 * @param {any} value - Value to await
 * @returns {any} The awaited value
 */
function _await_value(value): any;

Async Generator Helpers

_async_generator

Creates async generator implementations.

/**
 * Creates async generator implementations
 * @param {Function} fn - Generator function
 * @returns {Object} Async generator object
 */
function _async_generator(fn): Object;

_async_generator_delegate

Handles yield* delegation in async generators.

/**
 * Handles yield* delegation in async generators
 * @param {Object} inner - Inner iterator
 * @param {Function} awaitWrap - Await wrapper function
 * @returns {Object} Delegated async generator
 */
function _async_generator_delegate(inner, awaitWrap): Object;

_await_async_generator

Handles await operations in async generators.

/**
 * Handles await operations in async generators
 * @param {any} value - Value to await
 * @returns {Object} Awaited async generator value
 */
function _await_async_generator(value): Object;

_wrap_async_generator

Wraps async generator functions.

/**
 * Wraps async generator functions
 * @param {Function} fn - Async generator function
 * @returns {Function} Wrapped async generator
 */
function _wrap_async_generator(fn): Function;

Iterator Helpers

_async_iterator

Creates async iterators from iterables.

/**
 * Creates async iterators from iterables
 * @param {Iterable} iterable - Iterable to convert
 * @returns {AsyncIterator} Async iterator
 */
function _async_iterator(iterable): AsyncIterator;

_create_for_of_iterator_helper_loose

Creates loose mode for-of iterator helpers.

/**
 * Creates loose mode for-of iterator helpers
 * @param {Iterable} o - Iterable object
 * @param {boolean} allowArrayLike - Allow array-like objects
 * @returns {Object} Iterator helper
 */
function _create_for_of_iterator_helper_loose(o, allowArrayLike): Object;

Generator Utilities

_skip_first_generator_next

Skips the first next() call on generators.

/**
 * Skips the first next() call on generators
 * @param {Iterator} it - Generator iterator
 * @returns {any} Generator result
 */
function _skip_first_generator_next(it): any;

_overload_yield

Handles yield expression overloading.

/**
 * Handles yield expression overloading
 * @param {any} value - Value to yield
 * @returns {any} Yielded value
 */
function _overload_yield(value): any;

TypeScript Generator Helpers

_ts_generator

TypeScript-specific generator implementation (re-exported from tslib).

/**
 * TypeScript-specific generator implementation (re-exported from tslib.__generator)
 * @param {Object} thisArg - This context
 * @param {Function} body - Generator body function
 * @returns {Object} TypeScript generator
 */
function _ts_generator(thisArg, body): Object;

_ts_values

TypeScript values iterator helper (re-exported from tslib).

/**
 * TypeScript values iterator helper (re-exported from tslib.__values)
 * @param {any} o - Object to iterate
 * @returns {Iterator} Values iterator
 */
function _ts_values(o): Iterator;

Install with Tessl CLI

npx tessl i tessl/npm-swc--helpers

docs

async-generators.md

class-system.md

decorators.md

destructuring.md

index.md

module-interop.md

private-fields.md

type-system.md

utilities.md

tile.json