mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-17 15:03:07 +00:00
removed duplicate functions
This commit is contained in:
@@ -1,28 +1,7 @@
|
||||
// @TODO: Merge with keySelector function present in 'src/app/core/shared/selectors.ts'
|
||||
import { createSelector, MemoizedSelector, Selector } from '@ngrx/store';
|
||||
import { hasValue } from '../../shared/empty.util';
|
||||
import { MemoizedSelector } from '@ngrx/store';
|
||||
import { coreSelector, CoreState } from '../core.reducers';
|
||||
import { JsonPatchOperationsEntry, JsonPatchOperationsResourceEntry } from './json-patch-operations.reducer';
|
||||
|
||||
export function keySelector<T, V>(parentSelector: Selector<any, any>, subState: string, key: string): MemoizedSelector<T, V> {
|
||||
return createSelector(parentSelector, (state: T) => {
|
||||
if (hasValue(state[subState])) {
|
||||
return state[subState][key];
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
export function subStateSelector<T, V>(parentSelector: Selector<any, any>, subState: string): MemoizedSelector<T, V> {
|
||||
return createSelector(parentSelector, (state: T) => {
|
||||
if (hasValue(state[subState])) {
|
||||
return state[subState];
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
});
|
||||
}
|
||||
import { keySelector, subStateSelector } from '../../submission/selectors';
|
||||
|
||||
/**
|
||||
* Return MemoizedSelector to select all jsonPatchOperations for a specified resource type, stored in the state
|
||||
|
Reference in New Issue
Block a user