-
Notifications
You must be signed in to change notification settings - Fork 2
ReadOnlyObservableCollection.filter
API / ReadOnlyObservableCollection<TItem> / filter method
Creates a new JavaScript Array containing only the items for which the provided predicate
evaluates to true
.
This is a public method.
public filter(predicate: (item: TItem, index: number, collection: IReadOnlyObservableCollection<TItem>) => boolean): TItem[]
-
predicate: Function, the callback indicating which items to add in the result Array.
- item: TItem, the item being evaluated.
- index: Number, the index of the item being evaluated.
- collection: IReadOnlyObservableCollection<TItem>, the collection being iterated.
ReturnsReturns: Boolean
true
if the provided item satisfies the condition;false
otherwise.
Returns: TItem[]
A new Array containing the items for which the provided predicate
evaluated to true
.
Creates a new JavaScript Array containing only the items for which the provided predicate
evaluates to true
.
This is a public method.
public filter<TContext>(predicate: (this: TContext, item: TItem, index: number, collection: IReadOnlyObservableCollection<TItem>) => boolean, thisArg: TContext): TItem[]
- TContext: the context type in which the callback is executed.
-
predicate: Function, the callback indicating which items to add in the result Array.
- item: TItem, the item being evaluated.
- index: Number, the index of the item being evaluated.
- collection: IReadOnlyObservableCollection<TItem>, the collection being iterated.
ReturnsReturns: Boolean
true
if the provided item satisfies the condition;false
otherwise. - thisArg: TContext, a value to use as the callback context when mapping items.
Returns: TItem[]
A new Array containing the items for which the provided predicate
evaluated to true
.
Creates a new JavaScript Array containing only the items for which the provided predicate
evaluates to true
.
This is a public method.
public filter<TResult extends TItem>(predicate: (item: TItem, index: number, collection: IReadOnlyObservableCollection<TItem>) => item is TResult): TResult[]
-
TResult: the type to convert each item to.
Must extend TItem.
-
predicate: Function, the callback indicating which items to add in the result Array.
- item: TItem, the item being evaluated.
- index: Number, the index of the item being evaluated.
- collection: IReadOnlyObservableCollection<TItem>, the collection being iterated.
ReturnsReturns: Boolean
true
if the provided item satisfies the condition;false
otherwise.
Returns: TResult[]
A new Array containing the items for which the provided predicate
evaluated to true
.
Creates a new JavaScript Array containing only the items for which the provided predicate
evaluates to true
.
This is a public method.
public filter<TResult extends TItem, TContext>(predicate: (this: TContext, item: TItem, index: number, collection: IReadOnlyObservableCollection<TItem>) => item is TResult, thisArg: TContext): TResult[]
-
TResult: the type to convert each item to.
Must extend TItem. - TContext: the context type in which the callback is executed.
-
predicate: Function, the callback indicating which items to add in the result Array.
- item: TItem, the item being evaluated.
- index: Number, the index of the item being evaluated.
- collection: IReadOnlyObservableCollection<TItem>, the collection being iterated.
ReturnsReturns: Boolean
true
if the provided item satisfies the condition;false
otherwise. - thisArg: TContext, a value to use as the callback context when mapping items.
Returns: TResult[]
A new Array containing the items for which the provided predicate
evaluated to true
.
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