Skip to content

Commit

Permalink
README and CHANGELOG updated.
Browse files Browse the repository at this point in the history
  • Loading branch information
Smoren committed Apr 20, 2023
1 parent a9a6686 commit d24869d
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 2 deletions.
13 changes: 12 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# IterTools Typescript Change Log

## v1.22.0 - 2023-04-20

### New features
* math
* `runningAverage()`
* `runningAverageAsync()`
* Stream
* `runningAverage()`
* AsyncStream
* `runningAverage()`

## v1.21.0 - 2023-04-18

### Improvements
Expand All @@ -9,7 +20,7 @@
## v1.20.0 - 2023-04-15

### New features
* Math
* math
* `runningDifference()`
* `runningDifferenceAsync()`
* `runningMax()`
Expand Down
41 changes: 41 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ Quick Reference
#### Math Iteration
| Iterator | Description | Sync Code Snippet | Async Code Snippet |
|--------------------------------------------|---------------------------------|---------------------------------------------------|--------------------------------------------------------|
| [`runningAverage`](#Running-Average) | Running average accumulation | `math.runningAverage(numbers, [initialValue])` | `math.runningAverageAsync(numbers, [initialValue])` |
| [`runningDifference`](#Running-Difference) | Running difference accumulation | `math.runningDifference(numbers, [initialValue])` | `math.runningDifferenceAsync(numbers, [initialValue])` |
| [`runningMax`](#Running-Max) | Running maximum accumulation | `math.runningMax(numbers, [initialValue])` | `math.runningMax(numbers, [initialValue])` |
| [`runningMin`](#Running-Min) | Running minimum accumulation | `math.runningMin(numbers, [initialValue])` | `math.runningMinAsync(numbers, [initialValue])` |
Expand Down Expand Up @@ -226,6 +227,7 @@ Quick Reference
| [`map`](#Map-1) | Map function onto elements | `stream.map(mapper)` |
| [`pairwise`](#Pairwise-1) | Return pairs of elements from iterable source | `stream.pairwise()` |
| [`partialIntersectionWith`](#Partial-Intersection-With) | Partially intersect stream and given iterables | `stream.partialIntersectionWith(minIntersectionCount, ...iterables)` |
| [`runningAverage`](#Running-Average-1) | Accumulate the running average (mean) over iterable source | `stream.runningAverage([initialValue])` |
| [`runningDifference`](#Running-Difference-1) | Accumulate the running difference over iterable source | `stream.runningDifference([initialValue])` |
| [`runningMax`](#Running-Max-1) | Accumulate the running max over iterable source | `stream.runningMax([initialValue])` |
| [`runningMin`](#Running-Min-1) | Accumulate the running min over iterable source | `stream.runningMin([initialValue])` |
Expand Down Expand Up @@ -887,6 +889,27 @@ for (const value of single.keys(dict)) {

## Math Iteration

### Running Average
Accumulate the running average over a list of numbers.

```
function* runningAverage<T>(
numbers: Iterable<T> | Iterator<T>,
initialValue?: number
): Iterable<number>
```

```typescript
import { math } from 'itertools-ts';

const grades = [100, 80, 80, 90, 85];

for (const runningAverage of math.runningAverage(grades)) {
console.log(runningAverage);
}
// 100, 90, 86.667, 87.5, 87
```

### Running Difference
Accumulate the running difference over a list of numbers.

Expand Down Expand Up @@ -2365,6 +2388,24 @@ const result = Stream.of(staticallyTyped)
// c++, java, c#, go, php
```

#### Running Average
Return a stream accumulating the running average (mean) over the stream.

```
stream.runningAverage(initialValue?: number): Stream
```

```typescript
import { Stream } from 'itertools-ts';

const input = [1, 3, 5];

const result = Stream.of(input)
.runningAverage()
.toArray();
// 1, 2, 3
```

#### Running Difference
Return a stream accumulating the running difference over the stream.

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "itertools-ts",
"version": "1.21.0",
"version": "1.22.0",
"description": "Extended itertools port for TypeScript and JavaScript. Provides a huge set of functions for working with iterable collections (including async ones)",
"license": "MIT",
"repository": {
Expand Down

0 comments on commit d24869d

Please sign in to comment.