Options
All
  • Public
  • Public/Protected
  • All
Menu

Package iterable

@typed/iterable

Useful functions for working with Iterables

Index

Variables

Const ap

ap: { <A, B>(fn: Iterable<Arity1<A, B>>, value: Iterable<A>): Iterable<B>; <A, B>(fn: Iterable<Arity1<A, B>>): (value: Iterable<A>) => Iterable<B> } = curry(<A, B>(fn: Iterable<Arity1<A, B>>, value: Iterable<A>): Iterable<B> =>chain((f) => map(f, value), fn),) as {<A, B>(fn: Iterable<Arity1<A, B>>, value: Iterable<A>): Iterable<B><A, B>(fn: Iterable<Arity1<A, B>>): (value: Iterable<A>) => Iterable<B>}

Apply an async iterable of functions to an async iterable of values.

Type declaration

    • <A, B>(fn: Iterable<Arity1<A, B>>, value: Iterable<A>): Iterable<B>
    • <A, B>(fn: Iterable<Arity1<A, B>>): (value: Iterable<A>) => Iterable<B>
    • Type parameters

      • A

      • B

      Parameters

      • fn: Iterable<Arity1<A, B>>
      • value: Iterable<A>

      Returns Iterable<B>

    • Type parameters

      • A

      • B

      Parameters

      Returns (value: Iterable<A>) => Iterable<B>

        • (value: Iterable<A>): Iterable<B>
        • Parameters

          • value: Iterable<A>

          Returns Iterable<B>

Const append

append: { <A>(value: A, iterable: Iterable<A>): Iterable<A>; <A>(value: A): (iterable: Iterable<A>) => Iterable<A> } = curry(__append)

Type declaration

    • <A>(value: A, iterable: Iterable<A>): Iterable<A>
    • <A>(value: A): (iterable: Iterable<A>) => Iterable<A>
    • Type parameters

      • A

      Parameters

      • value: A
      • iterable: Iterable<A>

      Returns Iterable<A>

    • Type parameters

      • A

      Parameters

      • value: A

      Returns (iterable: Iterable<A>) => Iterable<A>

        • (iterable: Iterable<A>): Iterable<A>
        • Parameters

          • iterable: Iterable<A>

          Returns Iterable<A>

Const chain

chain: { <A, B>(fn: Arity1<A, Iterable<B>>, iterable: Iterable<A>): Iterable<B>; <A, B>(fn: Arity1<A, Iterable<B>>): (iterable: Iterable<A>) => Iterable<B> } = curry(__chain)

Type declaration

    • <A, B>(fn: Arity1<A, Iterable<B>>, iterable: Iterable<A>): Iterable<B>
    • <A, B>(fn: Arity1<A, Iterable<B>>): (iterable: Iterable<A>) => Iterable<B>
    • Type parameters

      • A

      • B

      Parameters

      • fn: Arity1<A, Iterable<B>>
      • iterable: Iterable<A>

      Returns Iterable<B>

    • Type parameters

      • A

      • B

      Parameters

      Returns (iterable: Iterable<A>) => Iterable<B>

        • (iterable: Iterable<A>): Iterable<B>
        • Parameters

          • iterable: Iterable<A>

          Returns Iterable<B>

Const concat

concat: { <A>(a: Iterable<A>, b: Iterable<A>): Iterable<A>; <A>(a: Iterable<A>): (b: Iterable<A>) => Iterable<A> } = curry(__concat)

Type declaration

    • <A>(a: Iterable<A>, b: Iterable<A>): Iterable<A>
    • <A>(a: Iterable<A>): (b: Iterable<A>) => Iterable<A>
    • Type parameters

      • A

      Parameters

      • a: Iterable<A>
      • b: Iterable<A>

      Returns Iterable<A>

    • Type parameters

      • A

      Parameters

      • a: Iterable<A>

      Returns (b: Iterable<A>) => Iterable<A>

        • (b: Iterable<A>): Iterable<A>
        • Parameters

          • b: Iterable<A>

          Returns Iterable<A>

Const contains

contains: { <A>(value: A, iterable: Iterable<A>): boolean; <A>(value: A): (iterable: Iterable<A>) => boolean } = curry(__contains)

Type declaration

    • <A>(value: A, iterable: Iterable<A>): boolean
    • <A>(value: A): (iterable: Iterable<A>) => boolean
    • Type parameters

      • A

      Parameters

      • value: A
      • iterable: Iterable<A>

      Returns boolean

    • Type parameters

      • A

      Parameters

      • value: A

      Returns (iterable: Iterable<A>) => boolean

        • (iterable: Iterable<A>): boolean
        • Parameters

          • iterable: Iterable<A>

          Returns boolean

Const drop

drop: { <A>(amount: number, iterable: Iterable<A>): Iterable<A>; (amount: number): <A>(iterable: Iterable<A>) => Iterable<A> } = curry(__drop) as {<A>(amount: number, iterable: Iterable<A>): Iterable<A>(amount: number): <A>(iterable: Iterable<A>) => Iterable<A>}

Type declaration

    • <A>(amount: number, iterable: Iterable<A>): Iterable<A>
    • (amount: number): <A>(iterable: Iterable<A>) => Iterable<A>
    • Type parameters

      • A

      Parameters

      • amount: number
      • iterable: Iterable<A>

      Returns Iterable<A>

    • Parameters

      • amount: number

      Returns <A>(iterable: Iterable<A>) => Iterable<A>

        • <A>(iterable: Iterable<A>): Iterable<A>
        • Type parameters

          • A

          Parameters

          • iterable: Iterable<A>

          Returns Iterable<A>

Const every

every: { <A>(predicate: Predicate<A>, iterable: Iterable<A>): boolean; <A>(predicate: Predicate<A>): (iterable: Iterable<A>) => boolean } = curry(<A>(predicate: Predicate<A>, iterable: Iterable<A>): boolean =>Array.from(iterable).every(predicate),)

Type declaration

    • <A>(predicate: Predicate<A>, iterable: Iterable<A>): boolean
    • <A>(predicate: Predicate<A>): (iterable: Iterable<A>) => boolean
    • Type parameters

      • A

      Parameters

      • predicate: Predicate<A>
      • iterable: Iterable<A>

      Returns boolean

    • Type parameters

      • A

      Parameters

      Returns (iterable: Iterable<A>) => boolean

        • (iterable: Iterable<A>): boolean
        • Parameters

          • iterable: Iterable<A>

          Returns boolean

Const filter

filter: { <A>(predicate: Predicate<A>, iterable: Iterable<A>): Iterable<A>; <A>(predicate: Predicate<A>): (iterable: Iterable<A>) => Iterable<A> } = curry(__filter)

Type declaration

    • <A>(predicate: Predicate<A>, iterable: Iterable<A>): Iterable<A>
    • <A>(predicate: Predicate<A>): (iterable: Iterable<A>) => Iterable<A>
    • Type parameters

      • A

      Parameters

      • predicate: Predicate<A>
      • iterable: Iterable<A>

      Returns Iterable<A>

    • Type parameters

      • A

      Parameters

      Returns (iterable: Iterable<A>) => Iterable<A>

        • (iterable: Iterable<A>): Iterable<A>
        • Parameters

          • iterable: Iterable<A>

          Returns Iterable<A>

Const find

find: { <A>(predicate: Predicate<A>, iterable: Iterable<A>): Maybe<A>; <A>(predicate: Predicate<A>): (iterable: Iterable<A>) => Maybe<A> } = curry(__find)

Type declaration

    • Type parameters

      • A

      Parameters

      • predicate: Predicate<A>
      • iterable: Iterable<A>

      Returns Maybe<A>

    • Type parameters

      • A

      Parameters

      Returns (iterable: Iterable<A>) => Maybe<A>

        • (iterable: Iterable<A>): Maybe<A>
        • Parameters

          • iterable: Iterable<A>

          Returns Maybe<A>

Const findIndex

findIndex: { <A>(predicate: Predicate<A>, iterable: Iterable<A>): Maybe<number>; <A>(predicate: Predicate<A>): (iterable: Iterable<A>) => Maybe<number> } = curry(__findIndex)

Type declaration

    • Type parameters

      • A

      Parameters

      • predicate: Predicate<A>
      • iterable: Iterable<A>

      Returns Maybe<number>

    • Type parameters

      • A

      Parameters

      Returns (iterable: Iterable<A>) => Maybe<number>

        • (iterable: Iterable<A>): Maybe<number>
        • Parameters

          • iterable: Iterable<A>

          Returns Maybe<number>

Const forEach

forEach: { <A>(fn: (value: A) => void, iterable: Iterable<A>): void; <A>(fn: (value: A) => void): (iterable: Iterable<A>) => void } = curry(__forEach)

Type declaration

    • <A>(fn: (value: A) => void, iterable: Iterable<A>): void
    • <A>(fn: (value: A) => void): (iterable: Iterable<A>) => void
    • Type parameters

      • A

      Parameters

      • fn: (value: A) => void
          • (value: A): void
          • Parameters

            • value: A

            Returns void

      • iterable: Iterable<A>

      Returns void

    • Type parameters

      • A

      Parameters

      • fn: (value: A) => void
          • (value: A): void
          • Parameters

            • value: A

            Returns void

      Returns (iterable: Iterable<A>) => void

        • (iterable: Iterable<A>): void
        • Parameters

          • iterable: Iterable<A>

          Returns void

Const map

map: { <A, B>(fn: Arity1<A, B>, iterable: Iterable<A>): Iterable<B>; <A, B>(fn: Arity1<A, B>): (iterable: Iterable<A>) => Iterable<B> } = curry(__map)

Type declaration

    • <A, B>(fn: Arity1<A, B>, iterable: Iterable<A>): Iterable<B>
    • <A, B>(fn: Arity1<A, B>): (iterable: Iterable<A>) => Iterable<B>
    • Type parameters

      • A

      • B

      Parameters

      • fn: Arity1<A, B>
      • iterable: Iterable<A>

      Returns Iterable<B>

    • Type parameters

      • A

      • B

      Parameters

      Returns (iterable: Iterable<A>) => Iterable<B>

        • (iterable: Iterable<A>): Iterable<B>
        • Parameters

          • iterable: Iterable<A>

          Returns Iterable<B>

Const prepend

prepend: { <A>(value: A, iterable: Iterable<A>): Iterable<A>; <A>(value: A): (iterable: Iterable<A>) => Iterable<A> } = curry(__prepend)

Type declaration

    • <A>(value: A, iterable: Iterable<A>): Iterable<A>
    • <A>(value: A): (iterable: Iterable<A>) => Iterable<A>
    • Type parameters

      • A

      Parameters

      • value: A
      • iterable: Iterable<A>

      Returns Iterable<A>

    • Type parameters

      • A

      Parameters

      • value: A

      Returns (iterable: Iterable<A>) => Iterable<A>

        • (iterable: Iterable<A>): Iterable<A>
        • Parameters

          • iterable: Iterable<A>

          Returns Iterable<A>

Const range

range: { (from: number, to: number): Iterable<number>; (from: number): (to: number) => Iterable<number> } = curry((from: number, to: number) => __rangeBy(from, to, 1))

Inclusive range by 1

Type declaration

    • (from: number, to: number): Iterable<number>
    • (from: number): (to: number) => Iterable<number>
    • Parameters

      • from: number
      • to: number

      Returns Iterable<number>

    • Parameters

      • from: number

      Returns (to: number) => Iterable<number>

        • (to: number): Iterable<number>
        • Parameters

          • to: number

          Returns Iterable<number>

Const rangeBy

rangeBy: { (from: number, to: number, by: number): Iterable<number>; (from: number, to: number): (by: number) => Iterable<number>; (from: number): { (to: number, by: number): Iterable<number>; (to: number): (by: number) => Iterable<number> } } = curry(__rangeBy)

Inclusive range by given increment

Type declaration

    • (from: number, to: number, by: number): Iterable<number>
    • (from: number, to: number): (by: number) => Iterable<number>
    • (from: number): { (to: number, by: number): Iterable<number>; (to: number): (by: number) => Iterable<number> }
    • Parameters

      • from: number
      • to: number
      • by: number

      Returns Iterable<number>

    • Parameters

      • from: number
      • to: number

      Returns (by: number) => Iterable<number>

        • (by: number): Iterable<number>
        • Parameters

          • by: number

          Returns Iterable<number>

    • Parameters

      • from: number

      Returns { (to: number, by: number): Iterable<number>; (to: number): (by: number) => Iterable<number> }

        • (to: number, by: number): Iterable<number>
        • (to: number): (by: number) => Iterable<number>
        • Parameters

          • to: number
          • by: number

          Returns Iterable<number>

        • Parameters

          • to: number

          Returns (by: number) => Iterable<number>

            • (by: number): Iterable<number>
            • Parameters

              • by: number

              Returns Iterable<number>

Const reduce

reduce: { <A, B>(reducer: Arity2<B, A, B>, seed: B, iterable: Iterable<A>): Promise<B>; <A, B>(reducer: Arity2<B, A, B>, seed: B): (iterable: Iterable<A>) => Promise<B>; <A, B>(reducer: Arity2<B, A, B>): { (seed: B, iterable: Iterable<A>): Promise<B>; (seed: B): (iterable: Iterable<A>) => Promise<B> } } = curry(__reduce) as any

Type declaration

    • <A, B>(reducer: Arity2<B, A, B>, seed: B, iterable: Iterable<A>): Promise<B>
    • <A, B>(reducer: Arity2<B, A, B>, seed: B): (iterable: Iterable<A>) => Promise<B>
    • <A, B>(reducer: Arity2<B, A, B>): { (seed: B, iterable: Iterable<A>): Promise<B>; (seed: B): (iterable: Iterable<A>) => Promise<B> }
    • Type parameters

      • A

      • B

      Parameters

      • reducer: Arity2<B, A, B>
      • seed: B
      • iterable: Iterable<A>

      Returns Promise<B>

    • Type parameters

      • A

      • B

      Parameters

      • reducer: Arity2<B, A, B>
      • seed: B

      Returns (iterable: Iterable<A>) => Promise<B>

        • (iterable: Iterable<A>): Promise<B>
        • Parameters

          • iterable: Iterable<A>

          Returns Promise<B>

    • Type parameters

      • A

      • B

      Parameters

      Returns { (seed: B, iterable: Iterable<A>): Promise<B>; (seed: B): (iterable: Iterable<A>) => Promise<B> }

        • (seed: B, iterable: Iterable<A>): Promise<B>
        • (seed: B): (iterable: Iterable<A>) => Promise<B>
        • Parameters

          • seed: B
          • iterable: Iterable<A>

          Returns Promise<B>

        • Parameters

          • seed: B

          Returns (iterable: Iterable<A>) => Promise<B>

            • (iterable: Iterable<A>): Promise<B>
            • Parameters

              • iterable: Iterable<A>

              Returns Promise<B>

Const take

take: { <A>(amount: number, iterable: Iterable<A>): Iterable<A>; (amount: number): <A>(iterable: Iterable<A>) => Iterable<A> } = curry(__take) as {<A>(amount: number, iterable: Iterable<A>): Iterable<A>(amount: number): <A>(iterable: Iterable<A>) => Iterable<A>}

Type declaration

    • <A>(amount: number, iterable: Iterable<A>): Iterable<A>
    • (amount: number): <A>(iterable: Iterable<A>) => Iterable<A>
    • Type parameters

      • A

      Parameters

      • amount: number
      • iterable: Iterable<A>

      Returns Iterable<A>

    • Parameters

      • amount: number

      Returns <A>(iterable: Iterable<A>) => Iterable<A>

        • <A>(iterable: Iterable<A>): Iterable<A>
        • Type parameters

          • A

          Parameters

          • iterable: Iterable<A>

          Returns Iterable<A>

Functions

__chain

  • __chain<A, B>(fn: Arity1<A, Iterable<B>>, iterable: Iterable<A>): Iterable<B>

__forEach

  • __forEach<A>(fn: (value: A) => void, iterable: Iterable<A>): void
  • Type parameters

    • A

    Parameters

    • fn: (value: A) => void
        • (value: A): void
        • Parameters

          • value: A

          Returns void

    • iterable: Iterable<A>

    Returns void

__map

  • __map<A, B>(fn: Arity1<A, B>, iterable: Iterable<A>): Iterable<B>

enumerate

  • enumerate<A>(iterable: Iterable<A>): Iterable<keyof [A, number]>

Generated using TypeDoc