Skip to content

Commit

Permalink
GH-2 Fixed observable collection reduce methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrei15193 committed Jun 20, 2022
1 parent 390f7e9 commit 52a0d83
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-model-view-viewmodel",
"version": "2.0.0",
"version": "2.0.1",
"description": "A library for developing React applications using Model-View-ViewModel inspired by .NET",
"main": "./lib/index.js",
"types": "./lib/index.d.ts",
Expand Down
6 changes: 3 additions & 3 deletions src/observable-collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ export class ReadOnlyObservableCollection<TItem> extends ViewModel implements IR
public reduce<TResult>(callbackfn: (previousValue: TResult, currentItem: TItem, currentIndex: number, collection: IReadOnlyObservableCollection<TItem>) => TResult, initialValue: TResult): TResult;
public reduce(callbackfn: any, initialValue?: any): any {
const collection = this;
return this._items.reduce(function (previousValue, currentItem, currentIndex) { return callbackfn.call(previousValue, currentItem, currentIndex, collection); }, initialValue);
return this._items.reduce(function (this: any, previousValue, currentItem, currentIndex) { return callbackfn.call(this, previousValue, currentItem, currentIndex, collection); }, initialValue);
}

/**
Expand All @@ -348,7 +348,7 @@ export class ReadOnlyObservableCollection<TItem> extends ViewModel implements IR
public reduceRight<TResult>(callbackfn: (previousValue: TResult, currentItem: TItem, currentIndex: number, collection: IReadOnlyObservableCollection<TItem>) => TResult, initialValue: TResult): TResult;
public reduceRight(callbackfn: any, initialValue?: any): any {
const collection = this;
return this._items.reduceRight(function (previousValue, currentItem, currentIndex) { return callbackfn.call(collection, previousValue, currentItem, currentIndex, collection); }, initialValue);
return this._items.reduceRight(function (this: any, previousValue, currentItem, currentIndex) { return callbackfn.call(this, collection, previousValue, currentItem, currentIndex, collection); }, initialValue);
}

/**
Expand Down Expand Up @@ -480,7 +480,7 @@ export class ReadOnlyObservableCollection<TItem> extends ViewModel implements IR
public flatMap<TResult>(callback: (item: TItem, index: number, collection: any) => TResult | readonly TResult[], thisArg?: any): TResult[];
public flatMap<TResult>(callback: (item: TItem, index: number, collection: any) => TResult | readonly TResult[], thisArg?: any): TResult[] {
const collection = this;
return this._items.flatMap(function (item, index) { return callback.call(this, item, index, collection); }, thisArg);
return this._items.flatMap(function (this: any, item, index) { return callback.call(this, item, index, collection); }, thisArg);
}

/**
Expand Down

0 comments on commit 52a0d83

Please sign in to comment.