Skip to content

Commit

Permalink
added async stream
Browse files Browse the repository at this point in the history
  • Loading branch information
anastansa authored and Smoren committed Apr 20, 2023
1 parent 04b6ae0 commit a9a6686
Show file tree
Hide file tree
Showing 2 changed files with 433 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/async-stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ import {
zipLongestAsync,
} from "./multi";
import {
runningAverage,
runningAverageAsync,
runningDifferenceAsync,
runningMaxAsync,
runningMinAsync,
Expand Down Expand Up @@ -423,6 +425,18 @@ export class AsyncStream {
return this;
}

/**
* Accumulate the running average (mean) over the stream.
*
* @param initialValue (Optional) If provided, the running average leads off with the initial value.
*
* @see math.runningAverageAsync
*/
runningAverage(initialValue?: number): AsyncStream {
this.data = runningAverageAsync(this.data, initialValue);
return this;
}

/**
* Accumulate the running difference over the stream.
*
Expand Down
Loading

0 comments on commit a9a6686

Please sign in to comment.