Options
All
  • Public
  • Public/Protected
  • All
Menu

Class MappableGenerator<T, TReturn, TNext>

Type parameters

  • T

  • TReturn

  • TNext

Hierarchy

  • MappableGenerator

Implements

  • Generator<T, TReturn, TNext>
  • Iterable<T>

Index

Properties

Optional returning

returning: any

Methods

Abstract [Symbol.iterator]

  • [Symbol.iterator](): Generator<T>

asArray

  • asArray(): T[]

concat

  • Concatenates generators (or iterators or iterables).

    Ensures that any supplied generators are terminated when this is terminated.

    Parameters

    • Rest ...gens: Genable<T>[]

      zero or more additional [Genable] to provide values.

    Returns MappableGenerator<T, any, unknown>

every

  • every(p: (v: T, idx: number) => boolean, thisArg?: any): boolean
  • Parameters

    • p: (v: T, idx: number) => boolean
        • (v: T, idx: number): boolean
        • Parameters

          • v: T
          • idx: number

          Returns boolean

    • Optional thisArg: any

    Returns boolean

filter

  • Parameters

    • p: (v: T) => boolean
        • (v: T): boolean
        • Parameters

          • v: T

          Returns boolean

    • Optional thisArg: any

    Returns MappableGenerator<T, TReturn, TNext>

flat

flatMap

  • Type parameters

    • D: number

    • R

    Parameters

    • f: (v: T, idx: number) => R
        • (v: T, idx: number): R
        • Parameters

          • v: T
          • idx: number

          Returns R

    • Default value depth: D = 1 as D

    Returns MappableGenerator<R>

forEach

  • forEach(f: (v: T) => void, thisArg?: any): any
  • Parameters

    • f: (v: T) => void
        • (v: T): void
        • Parameters

          • v: T

          Returns void

    • Optional thisArg: any

    Returns any

join

  • join(sep?: undefined | string): string
  • Trivial, but handy, same as Array.prototype.join.

    Parameters

    • Optional sep: undefined | string

    Returns string

map

Abstract next

  • next(): IteratorResult<T>

reduce

  • reduce<A>(f: (acc: A | T, v: T) => A): A
  • reduce<A>(f: (acc: A, v: T) => A, init: A): A
  • Like Array.prototype.reduce, but the 3rd argument to the reducing function ("array") is omitted because there is no array.

    Type parameters

    • A

    Parameters

    • f: (acc: A | T, v: T) => A
        • (acc: A | T, v: T): A
        • Parameters

          • acc: A | T
          • v: T

          Returns A

    Returns A

  • Like Array.prototype.reduce, but the 3rd argument to the reducing function ("array") is omitted because there is no array.

    Type parameters

    • A

    Parameters

    • f: (acc: A, v: T) => A
        • (acc: A, v: T): A
        • Parameters

          • acc: A
          • v: T

          Returns A

    • init: A

    Returns A

Abstract return

  • return(value: any): IteratorResult<T>
  • Parameters

    • value: any

    Returns IteratorResult<T>

slice

some

  • some(p: (v: T, idx: number) => boolean, thisArg?: any): boolean
  • Parameters

    • p: (v: T, idx: number) => boolean
        • (v: T, idx: number): boolean
        • Parameters

          • v: T
          • idx: number

          Returns boolean

    • Optional thisArg: any

    Returns boolean

Abstract throw

  • throw(e: any): IteratorResult<T>

Static concat

  • Concatenates generators (or iterators or iterables).

    Ensures that any supplied generators are terminated when this is terminated.

    Type parameters

    • T

    Parameters

    • Rest ...gens: Genable<T>[]

      zero or more additional [Genable] to provide values.

    Returns MappableGenerator<T>

Static every

  • every<T>(gen: Genable<T>, p: (v: T, idx: number) => boolean, thisArg?: any): boolean
  • Type parameters

    • T

    Parameters

    • gen: Genable<T>
    • p: (v: T, idx: number) => boolean
        • (v: T, idx: number): boolean
        • Parameters

          • v: T
          • idx: number

          Returns boolean

    • Optional thisArg: any

    Returns boolean

Static extend

Static filter

Static flat

Static flatMap

Static map

Static reduce

  • reduce<T, A>(gen: Genable<T>, f: (acc: A | T, v: T) => A): A
  • reduce<T, A>(gen: Genable<T>, f: (acc: A, v: T) => A, init: A): A
  • Reduces gen like Array.prototype.reduce, but the 3rd argument to the reducing function ("array") is omitted because there is no array.

    Type parameters

    • T

    • A

    Parameters

    • gen: Genable<T>
    • f: (acc: A | T, v: T) => A
        • (acc: A | T, v: T): A
        • Parameters

          • acc: A | T
          • v: T

          Returns A

    Returns A

  • Reduces gen like Array.prototype.reduce, but the 3rd argument to the reducing function ("array") is omitted because there is no array.

    Type parameters

    • T

    • A

    Parameters

    • gen: Genable<T>
    • f: (acc: A, v: T) => A
        • (acc: A, v: T): A
        • Parameters

          • acc: A
          • v: T

          Returns A

    • init: A

    Returns A

Static slice

Static some

  • some<T>(gen: Genable<T>, p: (v: T, idx: number) => boolean, thisArg?: any): boolean
  • Type parameters

    • T

    Parameters

    • gen: Genable<T>
    • p: (v: T, idx: number) => boolean
        • (v: T, idx: number): boolean
        • Parameters

          • v: T
          • idx: number

          Returns boolean

    • Optional thisArg: any

    Returns boolean

Generated using TypeDoc