UNPKG

itertools-ts

Version:

Extended itertools port for TypeScript and JavaScript. Provides a huge set of functions for working with iterable collections (including async ones)

86 lines (85 loc) 4.23 kB
import { Numeric } from "./types"; /** * Accumulate the running average (mean) over a list of numbers * * @param numbers * @param initialValue (Optional) If provided, the running average leads off with the initial value. */ export declare function runningAverage(numbers: Iterable<Numeric> | Iterator<Numeric>, initialValue?: number): Iterable<number>; /** * Accumulate the running average (mean) over a async collection of numbers * * @param numbers * @param initialValue (Optional) If provided, the running average leads off with the initial value. */ export declare function runningAverageAsync(numbers: AsyncIterable<Numeric> | AsyncIterator<Numeric> | Iterable<Numeric> | Iterator<Numeric>, initialValue?: number): AsyncIterable<number>; /** * Accumulate the running difference over a list of numbers * * @param numbers * @param initialValue (Optional) If provided, the running difference leads off with the initial value. */ export declare function runningDifference(numbers: Iterable<Numeric> | Iterator<Numeric>, initialValue?: number): Iterable<number>; /** * Accumulate the running difference over a async collection of numbers * * @param numbers * @param initialValue (Optional) If provided, the running difference leads off with the initial value. */ export declare function runningDifferenceAsync(numbers: AsyncIterable<Numeric> | AsyncIterator<Numeric> | Iterable<Numeric> | Iterator<Numeric>, initialValue?: number): AsyncIterable<number>; /** * Accumulate the running max over a list of numbers * * @param numbers * @param initialValue (Optional) If provided, the running max leads off with the initial value. */ export declare function runningMax(numbers: Iterable<Numeric> | Iterator<Numeric>, initialValue?: number): Iterable<number>; /** * Accumulate the running max over a async collection of numbers * * @param numbers * @param initialValue (Optional) If provided, the running max leads off with the initial value. */ export declare function runningMaxAsync(numbers: AsyncIterable<Numeric> | AsyncIterator<Numeric> | Iterable<Numeric> | Iterator<Numeric>, initialValue?: number): AsyncIterable<number>; /** * Accumulate the running min over a list of numbers * * @param numbers * @param initialValue (Optional) If provided, the running min leads off with the initial value. */ export declare function runningMin(numbers: Iterable<Numeric> | Iterator<Numeric>, initialValue?: number): Iterable<number>; /** * Accumulate the running min over a async collection of numbers * * @param numbers * @param initialValue (Optional) If provided, the running min leads off with the initial value. */ export declare function runningMinAsync(numbers: AsyncIterable<Numeric> | AsyncIterator<Numeric> | Iterable<Numeric> | Iterator<Numeric>, initialValue?: number): AsyncIterable<number>; /** * Accumulate the running product over a list of numbers * * @param numbers * @param initialValue (Optional) If provided, the running product leads off with the initial value. */ export declare function runningProduct(numbers: Iterable<Numeric> | Iterator<Numeric>, initialValue?: number): Iterable<number>; /** * Accumulate the running product over a async collection of numbers * * @param numbers * @param initialValue (Optional) If provided, the running product leads off with the initial value. */ export declare function runningProductAsync(numbers: AsyncIterable<Numeric> | AsyncIterator<Numeric> | Iterable<Numeric> | Iterator<Numeric>, initialValue?: number): AsyncIterable<number>; /** * Accumulate the running total over a list of numbers * * @param numbers * @param initialValue (Optional) If provided, the running total leads off with the initial value. */ export declare function runningTotal(numbers: Iterable<Numeric> | Iterator<Numeric>, initialValue?: number): Iterable<number>; /** * Accumulate the running total over a async collection of numbers * * @param numbers * @param initialValue (Optional) If provided, the running total leads off with the initial value. */ export declare function runningTotalAsync(numbers: AsyncIterable<Numeric> | AsyncIterator<Numeric> | Iterable<Numeric> | Iterator<Numeric>, initialValue?: number): AsyncIterable<number>;