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.
10 lines (9 loc) • 443 B
TypeScript
/**
* Calculates the simple moving average (SMA) of an array with a given window size.
* For example, movingAverage([1,2,3,4,5], 3) returns [2,3,4].
* @author @dailker
* @param {number[]} array - The input array of numbers.
* @param {number} windowSize - The size of the moving window.
* @returns {number[]} The array of moving averages.
*/
export declare function movingAverage(array: number[], windowSize: number): number[];