Skip to content

Commit

Permalink
feat: refactor Stream package, add more reducers and Stream methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Arvid Nicolaas committed Feb 10, 2024
1 parent 7b32e14 commit 6840c4f
Show file tree
Hide file tree
Showing 72 changed files with 7,210 additions and 5,636 deletions.
15 changes: 15 additions & 0 deletions deno_dist/actor/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,21 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [0.14.0](https://github.com/rimbu-org/rimbu/compare/@rimbu/actor@0.13.1...@rimbu/actor@0.14.0) (2024-01-26)

### Bug Fixes

- **actor:** ensure generateUUID works with both node 18 and node 20 ([4e2448a](https://github.com/rimbu-org/rimbu/commit/4e2448ae7aa816e2b79bbec6f29fca322ccbc463))

### Features

- major API improvements accross all packages, performance improvements for newer runtimes ([312e473](https://github.com/rimbu-org/rimbu/commit/312e473261696a8e8749399491b9fd29bb5c38ec))

### BREAKING CHANGES

- Many methods now take an options object instead of positional arguments for
readability

## [0.13.1](https://github.com/rimbu-org/rimbu/compare/@rimbu/actor@0.13.0...@rimbu/actor@0.13.1) (2023-12-09)

**Note:** Version bump only for package @rimbu/actor
Expand Down
10 changes: 5 additions & 5 deletions deno_dist/actor/main/actor.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { OptLazy } from '../../common/mod.ts';
import type { Reducer } from '../../stream/mod.ts';

import type { ActionBase } from './internal.ts';
Expand Down Expand Up @@ -83,15 +82,16 @@ export namespace Actor {
}): EnhancedActor {
const { reducer, middleware, enhancer, actions } = config;

let reducerState = OptLazy(reducer.init);

let index = 0;
let halted = false;

const halt = (): void => {
halted = true;
};

let reducerState = reducer.init(halt);

let index = 0;

const listeners = new Set<Actor.Listener>();

const STALE_STATE = Symbol();
Expand Down Expand Up @@ -121,7 +121,7 @@ export namespace Actor {
const actor: any = {
getState: (): S => {
if (STALE_STATE === cacheState) {
cacheState = reducer.stateToResult(reducerState);
cacheState = reducer.stateToResult(reducerState, index, halted);
}

return cacheState;
Expand Down
15 changes: 15 additions & 0 deletions deno_dist/base/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,21 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [2.0.0](https://github.com/rimbu-org/rimbu/compare/@rimbu/base@1.1.0...@rimbu/base@2.0.0) (2024-01-26)

### Features

- major API improvements accross all packages, performance improvements for newer runtimes ([312e473](https://github.com/rimbu-org/rimbu/commit/312e473261696a8e8749399491b9fd29bb5c38ec))

### Performance Improvements

- **base:** export most performant arr methods based on available array methods ([714e66e](https://github.com/rimbu-org/rimbu/commit/714e66ed60289bc5eefff827e7ae167e8131cfb7))

### BREAKING CHANGES

- Many methods now take an options object instead of positional arguments for
readability

# [1.1.0](https://github.com/rimbu-org/rimbu/compare/@rimbu/base@1.0.0...@rimbu/base@1.1.0) (2023-07-29)

### Features
Expand Down
11 changes: 11 additions & 0 deletions deno_dist/bimap/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [2.0.0](https://github.com/rimbu-org/rimbu/compare/@rimbu/bimap@1.1.1...@rimbu/bimap@2.0.0) (2024-01-26)

### Features

- major API improvements accross all packages, performance improvements for newer runtimes ([312e473](https://github.com/rimbu-org/rimbu/commit/312e473261696a8e8749399491b9fd29bb5c38ec))

### BREAKING CHANGES

- Many methods now take an options object instead of positional arguments for
readability

## [1.1.1](https://github.com/rimbu-org/rimbu/compare/@rimbu/bimap@1.1.0...@rimbu/bimap@1.1.1) (2023-12-09)

**Note:** Version bump only for package @rimbu/bimap
Expand Down
11 changes: 11 additions & 0 deletions deno_dist/bimultimap/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [2.0.0](https://github.com/rimbu-org/rimbu/compare/@rimbu/bimultimap@1.1.1...@rimbu/bimultimap@2.0.0) (2024-01-26)

### Features

- major API improvements accross all packages, performance improvements for newer runtimes ([312e473](https://github.com/rimbu-org/rimbu/commit/312e473261696a8e8749399491b9fd29bb5c38ec))

### BREAKING CHANGES

- Many methods now take an options object instead of positional arguments for
readability

## [1.1.1](https://github.com/rimbu-org/rimbu/compare/@rimbu/bimultimap@1.1.0...@rimbu/bimultimap@1.1.1) (2023-12-09)

**Note:** Version bump only for package @rimbu/bimultimap
Expand Down
11 changes: 11 additions & 0 deletions deno_dist/channel/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [0.2.0](https://github.com/rimbu-org/rimbu/compare/@rimbu/channel@0.1.1...@rimbu/channel@0.2.0) (2024-01-26)

### Features

- major API improvements accross all packages, performance improvements for newer runtimes ([312e473](https://github.com/rimbu-org/rimbu/commit/312e473261696a8e8749399491b9fd29bb5c38ec))

### BREAKING CHANGES

- Many methods now take an options object instead of positional arguments for
readability

## [0.1.1](https://github.com/rimbu-org/rimbu/compare/@rimbu/channel@0.1.0...@rimbu/channel@0.1.1) (2023-12-09)

**Note:** Version bump only for package @rimbu/channel
Expand Down
11 changes: 11 additions & 0 deletions deno_dist/collection-types/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [2.0.0](https://github.com/rimbu-org/rimbu/compare/@rimbu/collection-types@1.1.1...@rimbu/collection-types@2.0.0) (2024-01-26)

### Features

- major API improvements accross all packages, performance improvements for newer runtimes ([312e473](https://github.com/rimbu-org/rimbu/commit/312e473261696a8e8749399491b9fd29bb5c38ec))

### BREAKING CHANGES

- Many methods now take an options object instead of positional arguments for
readability

## [1.1.1](https://github.com/rimbu-org/rimbu/compare/@rimbu/collection-types@1.1.0...@rimbu/collection-types@1.1.1) (2023-12-09)

**Note:** Version bump only for package @rimbu/collection-types
Expand Down
8 changes: 8 additions & 0 deletions deno_dist/collection-types/set-custom/interface/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,14 @@ export interface VariantSetBase<
* // => [1, 2]
* ```
*/
filter<TF extends T>(
pred: (value: T, index: number, halt: () => void) => value is TF,
options?: { negate?: false | undefined }
): WithElem<Tp, TF>['normal'];
filter<TF extends T>(
pred: (value: T, index: number, halt: () => void) => value is TF,
options: { negate: true }
): WithElem<Tp, Exclude<T, TF>>['normal'];
filter(
pred: (value: T, index: number, halt: () => void) => boolean,
options?: { negate?: boolean }
Expand Down
11 changes: 11 additions & 0 deletions deno_dist/common/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [2.0.0](https://github.com/rimbu-org/rimbu/compare/@rimbu/common@1.1.0...@rimbu/common@2.0.0) (2024-01-26)

### Features

- major API improvements accross all packages, performance improvements for newer runtimes ([312e473](https://github.com/rimbu-org/rimbu/commit/312e473261696a8e8749399491b9fd29bb5c38ec))

### BREAKING CHANGES

- Many methods now take an options object instead of positional arguments for
readability

# [1.1.0](https://github.com/rimbu-org/rimbu/compare/@rimbu/common@1.0.0...@rimbu/common@1.1.0) (2023-07-29)

### Features
Expand Down
11 changes: 11 additions & 0 deletions deno_dist/core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [2.0.0](https://github.com/rimbu-org/rimbu/compare/@rimbu/core@1.1.3...@rimbu/core@2.0.0) (2024-01-26)

### Features

- major API improvements accross all packages, performance improvements for newer runtimes ([312e473](https://github.com/rimbu-org/rimbu/commit/312e473261696a8e8749399491b9fd29bb5c38ec))

### BREAKING CHANGES

- Many methods now take an options object instead of positional arguments for
readability

## [1.1.3](https://github.com/rimbu-org/rimbu/compare/@rimbu/core@1.1.2...@rimbu/core@1.1.3) (2023-12-25)

**Note:** Version bump only for package @rimbu/core
Expand Down
11 changes: 11 additions & 0 deletions deno_dist/deep/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [2.0.0](https://github.com/rimbu-org/rimbu/compare/@rimbu/deep@1.1.0...@rimbu/deep@2.0.0) (2024-01-26)

### Features

- major API improvements accross all packages, performance improvements for newer runtimes ([312e473](https://github.com/rimbu-org/rimbu/commit/312e473261696a8e8749399491b9fd29bb5c38ec))

### BREAKING CHANGES

- Many methods now take an options object instead of positional arguments for
readability

# [1.1.0](https://github.com/rimbu-org/rimbu/compare/@rimbu/deep@1.0.0...@rimbu/deep@1.1.0) (2023-07-29)

### Features
Expand Down
11 changes: 11 additions & 0 deletions deno_dist/graph/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [2.0.0](https://github.com/rimbu-org/rimbu/compare/@rimbu/graph@1.1.1...@rimbu/graph@2.0.0) (2024-01-26)

### Features

- major API improvements accross all packages, performance improvements for newer runtimes ([312e473](https://github.com/rimbu-org/rimbu/commit/312e473261696a8e8749399491b9fd29bb5c38ec))

### BREAKING CHANGES

- Many methods now take an options object instead of positional arguments for
readability

## [1.1.1](https://github.com/rimbu-org/rimbu/compare/@rimbu/graph@1.1.0...@rimbu/graph@1.1.1) (2023-12-09)

### Bug Fixes
Expand Down
11 changes: 11 additions & 0 deletions deno_dist/hashed/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [2.0.0](https://github.com/rimbu-org/rimbu/compare/@rimbu/hashed@1.1.1...@rimbu/hashed@2.0.0) (2024-01-26)

### Features

- major API improvements accross all packages, performance improvements for newer runtimes ([312e473](https://github.com/rimbu-org/rimbu/commit/312e473261696a8e8749399491b9fd29bb5c38ec))

### BREAKING CHANGES

- Many methods now take an options object instead of positional arguments for
readability

## [1.1.1](https://github.com/rimbu-org/rimbu/compare/@rimbu/hashed@1.1.0...@rimbu/hashed@1.1.1) (2023-12-09)

### Bug Fixes
Expand Down
4 changes: 2 additions & 2 deletions deno_dist/hashed/set-custom/implementation/immutable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ export abstract class HashSetNonEmptyBase<T>

filter(
pred: (value: T, index: number, halt: () => void) => boolean,
options: { negate?: boolean } = {}
): HashSet<T> {
options: { negate?: boolean | undefined } = {}
): any {
const builder = this.context.builder();

builder.addAll(this.stream().filter(pred, options));
Expand Down
11 changes: 11 additions & 0 deletions deno_dist/list/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [2.0.0](https://github.com/rimbu-org/rimbu/compare/@rimbu/list@1.1.1...@rimbu/list@2.0.0) (2024-01-26)

### Features

- major API improvements accross all packages, performance improvements for newer runtimes ([312e473](https://github.com/rimbu-org/rimbu/commit/312e473261696a8e8749399491b9fd29bb5c38ec))

### BREAKING CHANGES

- Many methods now take an options object instead of positional arguments for
readability

## [1.1.1](https://github.com/rimbu-org/rimbu/compare/@rimbu/list@1.1.0...@rimbu/list@1.1.1) (2023-12-09)

### Bug Fixes
Expand Down
2 changes: 1 addition & 1 deletion deno_dist/list/custom/implementation/empty.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export class Empty<T = any> extends EmptyBase implements List<T> {
return this;
}

filter(): this {
filter(): any {
return this;
}

Expand Down
8 changes: 6 additions & 2 deletions deno_dist/list/custom/implementation/leaf/non-empty.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,12 @@ export abstract class ListNonEmptyBase<T>

filter(
pred: (value: T, index: number, halt: () => void) => boolean,
options: { range?: IndexRange; reversed?: boolean; negate?: boolean } = {}
): List<T> {
options: {
range?: IndexRange | undefined;
reversed?: boolean | undefined;
negate?: boolean | undefined;
} = {}
): any {
const { range, reversed = false, negate = false } = options;

const stream =
Expand Down
16 changes: 16 additions & 0 deletions deno_dist/list/main/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,22 @@ export interface List<T> extends FastIterable<T> {
* .filter((_, i) => i > 1, undefined, true) // -> List(1, 0)
* ```
*/
filter<TF extends T>(
pred: (value: T, index: number, halt: () => void) => value is TF,
options?: {
range?: IndexRange;
reversed?: boolean;
negate?: false | undefined;
}
): List<TF>;
filter<TF extends T>(
pred: (value: T, index: number, halt: () => void) => value is TF,
options: {
range?: IndexRange;
reversed?: boolean;
negate: true;
}
): List<Exclude<T, TF>>;
filter(
pred: (value: T, index: number, halt: () => void) => boolean,
options?: { range?: IndexRange; reversed?: boolean; negate?: boolean }
Expand Down
11 changes: 11 additions & 0 deletions deno_dist/multimap/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [2.0.0](https://github.com/rimbu-org/rimbu/compare/@rimbu/multimap@1.1.1...@rimbu/multimap@2.0.0) (2024-01-26)

### Features

- major API improvements accross all packages, performance improvements for newer runtimes ([312e473](https://github.com/rimbu-org/rimbu/commit/312e473261696a8e8749399491b9fd29bb5c38ec))

### BREAKING CHANGES

- Many methods now take an options object instead of positional arguments for
readability

## [1.1.1](https://github.com/rimbu-org/rimbu/compare/@rimbu/multimap@1.1.0...@rimbu/multimap@1.1.1) (2023-12-09)

**Note:** Version bump only for package @rimbu/multimap
Expand Down
11 changes: 11 additions & 0 deletions deno_dist/multiset/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [2.0.0](https://github.com/rimbu-org/rimbu/compare/@rimbu/multiset@1.1.1...@rimbu/multiset@2.0.0) (2024-01-26)

### Features

- major API improvements accross all packages, performance improvements for newer runtimes ([312e473](https://github.com/rimbu-org/rimbu/commit/312e473261696a8e8749399491b9fd29bb5c38ec))

### BREAKING CHANGES

- Many methods now take an options object instead of positional arguments for
readability

## [1.1.1](https://github.com/rimbu-org/rimbu/compare/@rimbu/multiset@1.1.0...@rimbu/multiset@1.1.1) (2023-12-09)

**Note:** Version bump only for package @rimbu/multiset
Expand Down
2 changes: 1 addition & 1 deletion deno_dist/multiset/custom/implementation/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ export class MultiSetNonEmpty<

filterEntries(
pred: (entry: readonly [T, number], index: number) => boolean,
options: { negate?: boolean } = {}
options: { negate?: boolean | undefined } = {}
): TpG['normal'] {
const builder = this.context.builder();

Expand Down
8 changes: 8 additions & 0 deletions deno_dist/multiset/custom/interface/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,14 @@ export interface VariantMultiSetBase<
* // => [[2, 2]]
* ```
*/
filterEntries<TF extends T>(
pred: (entry: readonly [T, number], index: number) => entry is [TF, number],
options?: { negate?: false | undefined }
): WithElem<Tp, TF>['normal'];
filterEntries<TF extends T>(
pred: (entry: readonly [T, number], index: number) => entry is [TF, number],
options: { negate: true }
): WithElem<Tp, Exclude<T, TF>>['normal'];
filterEntries(
pred: (entry: readonly [T, number], index: number) => boolean,
options?: { negate?: boolean }
Expand Down
Loading

0 comments on commit 6840c4f

Please sign in to comment.