UNPKG

everyutil

Version:

A comprehensive library of lightweight, reusable utility functions for JavaScript and TypeScript, designed to streamline common programming tasks such as string manipulation, array processing, date handling, and more.

12 lines (11 loc) 580 B
/** * Applies a reducer function on sliding windows of the array. * @author @dailker * @template T, U * @param {T[]} array - The input array. * @param {(acc: U, window: T[], index: number, array: T[]) => U} reducer - The reducer function. * @param {U} initialValue - The initial accumulator value. * @param {number} windowSize - The size of the sliding window. * @returns {U} The reduced value. */ export declare function windowedReduce<T, U>(array: T[], reducer: (acc: U, window: T[], index: number, array: T[]) => U, initialValue: U, windowSize: number): U;