-
Notifications
You must be signed in to change notification settings - Fork 2
ReadOnlyObservableCollection.reduce
API / ReadOnlyObservableCollection<TItem> / reduce method
Aggregates the collection to a single item.
This is a public method.
public reduce(callbackfn: (previousValue: TItem, currentItem: TItem, currentIndex: number, array: readonly TItem[]) => TItem): TItem
-
callbackfn: Function, the callback that aggregates two items at a time.
- previousValue: TItem, the current result value, returned from a previous invocation of the callback.
- currentItem: TItem, the item being processed.
- currentIndex: Number, the index of the item being processed.
- collection: IReadOnlyObservableCollection<TItem>, the collection being iterated.
previousValue
andcurrentItem
.
Returns a single aggregated item.
Aggregates the collection to a single value.
This is a public method.
public reduce<TResult>(callbackfn: (previousValue: TResult, currentItem: TItem, currentIndex: number, array: readonly TItem[]) => TResult, initialValue: TResult): TResult
- TResult: the type of value to aggregate the collection to.
-
callbackfn: Function, the callback that aggregates one item and the previous value at a time.
- previousValue: TResult, the current result value, returned from a previous invocation of the callback.
- currentItem: TItem, the item being processed.
- currentIndex: Number, the index of the item being processed.
- collection: IReadOnlyObservableCollection<TItem>, the collection being iterated.
previousValue
andcurrentItem
. -
initialValue:
TResult
, the initial value when aggregating the collection.
Returns the value containing the aggregated collection.
Motivation
Overview
Guides and Tutorials - Getting Started
Releases
API
Events
IEvent
IEventHandler
INotifyPropertiesChanged
INotifyCollectionChanged
IItemAddedEventArgs
IItemRemovedEventArgs
ICollectionChange
ItemRemovedCallback
ICollectionChange
EventDispatcher
Observable Collections
IReadOnlyObservableCollection
IObservableCollection
ReadOnlyObservableCollection
ObservableCollection
ViewModels
ViewModel
isViewModel
Forms
IFormFieldViewModel
IFormFieldViewModelConfig
FormFieldViewModel
FormFieldCollectionViewModel
FormFieldSet
DynamicFormFieldCollectionViewModel
Validation
IReadOnlyValidatable
IValidatable
IValidationConfig
ValidatorCallback
CollectionItemValidatorCallback
ValidatableSelectorCallback
ValidationConfigSelectorCallback
UnsubscribeCallback
registerValidators
registerCollectionValidators
registerCollectionItemValidators
React Hooks
EventHandler
useEvent
ViewModelType
ViewModelFactory
useViewModel
useViewModelMemo
useObservableCollection
useValidators
useCollectionValidators
useCollectionItemValidators