initial sorting implementation

This commit is contained in:
Niels Lyngsø
2023-04-18 12:55:53 +02:00
parent 35d61c85d6
commit d65cf550bc
9 changed files with 162 additions and 58 deletions

View File

@@ -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));
}

View File

@@ -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';