Options
All
  • Public
  • Public/Protected
  • All
Menu

iterplus - v3.0.2

Index

Type aliases

Null: typeof nullVal

The type of null to use.

PromiseOrValue<T>: T | Promise<T>

A promise or a value that can be awaited.

Type parameters

  • T

Variables

nullVal: null = null

The value of null to use.

Defaults to null.

Functions

  • Generates an AsyncIterPlus from an async iterable.

    Type parameters

    • T

      The iteration type.

    Parameters

    • iter: AsyncIterable<T>

      The async iterable to upgrade.

    Returns AsyncIterPlus<T>

  • asyncify<A, R>(func: (...args: A) => R): (...args: A) => Promise<R>
  • Lifts an function to an async function that immediately resolves the return value.

    Type parameters

    • A: unknown[]

      The arguments of the function.

    • R

      The return value of the function.

    Parameters

    • func: (...args: A) => R

      The function to lift.

        • (...args: A): R
        • Parameters

          • Rest ...args: A

          Returns R

    Returns (...args: A) => Promise<R>

    The lifted function.

      • (...args: A): Promise<R>
      • Lifts an function to an async function that immediately resolves the return value.

        Parameters

        • Rest ...args: A

        Returns Promise<R>

        The lifted function.

  • canAsyncIter(obj: any): obj is AsyncIterable<unknown>
  • Tests if an object is iterable.

    Parameters

    • obj: any

      The object to test for.

    Returns obj is AsyncIterable<unknown>

    If obj is an iterable.

  • canIter(obj: any): obj is Iterable<unknown>
  • Tests if an object is iterable.

    Parameters

    • obj: any

      The object to test for.

    Returns obj is Iterable<unknown>

    If obj is an iterable.

  • count(start: bigint, step?: bigint): IterPlus<bigint>
  • count(start: number, step?: number): IterPlus<number>
  • Creates an iterator that keeps adding values to a starting point.

    Parameters

    • start: bigint

      The starting point.

    • Optional step: bigint

      The step.

    Returns IterPlus<bigint>

  • Creates an iterator that keeps adding values to a starting point.

    Parameters

    • start: number

      The starting point.

    • Optional step: number

      The step.

    Returns IterPlus<number>

  • isAsyncIter(obj: any): obj is AsyncIterator<unknown, any, undefined>
  • Tests if an object is an iterator.

    Parameters

    • obj: any

      The object to test for.

    Returns obj is AsyncIterator<unknown, any, undefined>

    If obj is an iterator.

  • isIter(obj: any): obj is Iterator<unknown, any, undefined>
  • Tests if an object is an iterator.

    Parameters

    • obj: any

      The object to test for.

    Returns obj is Iterator<unknown, any, undefined>

    If obj is an iterator.

  • iterplus<T>(iter: Iterable<T>): IterPlus<T>
  • Generates an IterPlus from an iterable.

    Type parameters

    • T

      The iteration type.

    Parameters

    • iter: Iterable<T>

      The iterable to upgrade.

    Returns IterPlus<T>

  • Lifts an iterable to an async iterable that immediately resolves promises.

    Type parameters

    • T

      The item of the iterator.

    Parameters

    • iterable: Iterable<T>

      The iterable to lift.

    Returns AsyncIterPlus<T>

    The lifted iterator.

  • range(start: bigint, dest?: bigint, step?: bigint): IterPlus<bigint>
  • range(start: number, dest?: number, step?: number): IterPlus<number>
  • Creates an inclusive-exclusive range iterator that's useful for loops.

    Parameters

    • start: bigint

      The starting point.

    • Optional dest: bigint

      The ending point, exclusive.

    • Optional step: bigint

      The step, can be negative to go down.

    Returns IterPlus<bigint>

  • Creates an inclusive-exclusive range iterator that's useful for loops.

    Parameters

    • start: number

      The starting point.

    • Optional dest: number

      The ending point, exclusive.

    • Optional step: number

      The step, can be negative to go down.

    Returns IterPlus<number>

Generated using TypeDoc