initial sorting implementation
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
/**
|
||||
* @export
|
||||
* @method filterFrozenArray
|
||||
* @param {Array<T>} data - RxJS Subject to use for this Observable.
|
||||
* @param {(entry: T) => boolean} filterMethod - Method to filter the array.
|
||||
* @description - Creates a RxJS Observable from RxJS Subject.
|
||||
* @example <caption>Example remove an entry of a ArrayState or a part of DeepState/ObjectState it which is an array. Where the key is unique and the item will be updated if matched with existing.</caption>
|
||||
* const newDataSet = filterFrozenArray(mySubject.getValue(), x => x.id !== "myKey");
|
||||
* mySubject.next(newDataSet);
|
||||
*/
|
||||
export function filterFrozenArray<T>(data: T[], filterMethod: (entry: T) => boolean): T[] {
|
||||
return [...data].filter((x) => filterMethod(x));
|
||||
}
|
||||
@@ -10,5 +10,6 @@ export * from './array-state';
|
||||
export * from './object-state';
|
||||
export * from './create-observable-part.function';
|
||||
export * from './append-to-frozen-array.function';
|
||||
export * from './filter-frozen-array.function';
|
||||
export * from './partial-update-frozen-array.function';
|
||||
export * from './mapping-function';
|
||||
|
||||
Reference in New Issue
Block a user